MimIR 0.1
MimIR is my Intermediate Representation
Loading...
Searching...
No Matches
mim Namespace Reference

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 swapping 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 conset 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)

GIDSet / GIDMap keyed by Def::gid of Def*.

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 const Var*.

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 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>
 
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 Appisa_callee (const Def *def, size_t i)
 
Lamisa_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 Defcompose_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 mut's ops by substituting mut's Var with arg.

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 Defflatten (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 Defunflatten (const Def *def, const Def *type)
 Applies the reverse transformation on a Pack / Tuple, given the original type.
 
const Defunflatten (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 Defmerge_sigma (const Def *def, Defs defs)
 
const Defmerge_tuple (const Def *def, Defs defs)
 
Ref tuple_of_types (Ref t)
 
Formatted Output

Provides a printf-like interface to format s with args and puts it into os.

Use {} as a placeholder within your format string s.

  • By default, os << t will be used to stream the appropriate argument:
    print(os, "int: {}, float: {}", 23, 42.f);
    std::ostream & print(std::ostream &os, const char *s)
    Base case.
    Definition print.cpp:5
  • You can also place a function as argument to inject arbitrary code:
    print(os, "int: {}, fun: {}, float: {}", 23, [&]() { os << "hey :)"}, 42.f);
  • There is also a variant to pass os to the function, if you don't have easy access to it:
    print(os, "int: {}, fun: {}, float: {}", 23, [&](auto& os) { os << "hey :)"}, 42.f);
  • You can put a std::ranges::range as argument. This will output a list - using the given specifier as separator. Each element elem of the range will be output via os << elem:
    std::vector<int> v = {0, 1, 2, 3};
    print(os, "v: {, }", v);
  • If you have a std::ranges::range that needs to be formatted in a more complicated way, bundle it with an Elem:
    std::vector<int> v = {3, 2, 1, 0};
    size_t i = 0;
    print(os, "v: {, }", Elem(v, [&](auto elem) { print(os, "{}: {}", i++, elem); }));
  • You again have the option to pass os to the bundled function:
    std::vector<int> v = {3, 2, 1, 0};
    size_t i = 0;
    print(os, "v: {, }", Elem(v, [&](auto& os, auto elem) { print(os, "{}: {}", i++, elem); }));
    * Use `{{` or `}}` to literally output `{` or `{`:
    print(os, "{{{}}}", 23); // "{23}"
    See also
    Tab
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 std::cout/std::cerr; the *ln variants emit an additional std::endl.

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 >
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 >
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

See also
Plugin
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 ()
 

Class Documentation

◆ mim::Flags

struct mim::Flags

Compiler switches that must be saved and looked up in later phases of compilation.

See also
Command-Line Reference

Definition at line 11 of file flags.h.

Class Members
bool aggressive_lam_spec = false
bool ascii = false
bool bootstrap = false
bool break_on_alpha_unequal = false
bool break_on_error = false
bool break_on_warn = false
bool disable_type_checking = false
uint32_t dump_gid = 0
bool dump_recursive = false
bool reeval_breakpoints = false
uint64_t scalarize_threshold = 32
bool trace_gids = false

Typedef Documentation

◆ B_CFG

using mim::B_CFG = CFG<false>

Definition at line 13 of file scope.h.

◆ Backends

using mim::Backends = absl::btree_map<std::string, void (*)(World&, std::ostream&)>

Definition at line 23 of file plugin.h.

◆ Bot

using mim::Bot = TExt<false>

Definition at line 177 of file lattice.h.

◆ CFNodes

using mim::CFNodes = GIDSet<const CFNode*>

Definition at line 22 of file cfg.h.

◆ ControlDeps

Definition at line 43 of file domfrontier.h.

◆ Def2Def

using mim::Def2Def = DefMap<const Def*>

Definition at line 60 of file def.h.

◆ DefDef

using mim::DefDef = std::tuple<const Def*, const Def*>

Definition at line 631 of file def.h.

◆ DefDefMap

template<class To >
using mim::DefDefMap = absl::flat_hash_map<DefDef, To, DefDefHash, DefDefEq>

Definition at line 646 of file def.h.

◆ DefDefSet

using mim::DefDefSet = absl::flat_hash_set<DefDef, DefDefHash, DefDefEq>

Definition at line 647 of file def.h.

◆ DefMap

template<class To >
using mim::DefMap = GIDMap<const Def*, To>

Definition at line 58 of file def.h.

◆ Defs

using mim::Defs = View<const Def*>

Definition at line 61 of file def.h.

◆ DefSet

using mim::DefSet = GIDSet<const Def*>

Definition at line 59 of file def.h.

◆ DefVec

using mim::DefVec = Vector<const Def*>

Definition at line 62 of file def.h.

◆ DomFrontiers

Definition at line 42 of file domfrontier.h.

◆ DomTree

typedef DomTreeBase< true > mim::DomTree = DomTreeBase<true>

Definition at line 46 of file domtree.h.

◆ f16

using mim::f16 = half

Definition at line 39 of file types.h.

◆ f32

using mim::f32 = float

Definition at line 40 of file types.h.

◆ f64

using mim::f64 = double

Definition at line 41 of file types.h.

◆ F_CFG

using mim::F_CFG = CFG<true>

Definition at line 12 of file scope.h.

◆ flags_t

using mim::flags_t = u64

Definition at line 45 of file types.h.

◆ GIDMap

template<class K , class V >
using mim::GIDMap = absl::flat_hash_map<K, V, GIDHash<K>, GIDEq<K>>

Definition at line 179 of file util.h.

◆ GIDNodeMap

template<class K , class V >
using mim::GIDNodeMap = absl::node_hash_map<K, V, GIDHash<K>, GIDEq<K>>

Definition at line 181 of file util.h.

◆ GIDNodeSet

template<class K >
using mim::GIDNodeSet = absl::node_hash_set<K, GIDHash<K>, GIDEq<K>>

Definition at line 182 of file util.h.

◆ GIDSet

template<class K >
using mim::GIDSet = absl::flat_hash_set<K, GIDHash<K>, GIDEq<K>>

Definition at line 180 of file util.h.

◆ hash_t

using mim::hash_t = uint32_t

Definition at line 9 of file hash.h.

◆ Join

using mim::Join = TBound<true>

Definition at line 180 of file lattice.h.

◆ Lam2Lam

using mim::Lam2Lam = LamMap<Lam*>

Definition at line 201 of file lam.h.

◆ LamMap

template<class To >
using mim::LamMap = GIDMap<Lam*, To>

Definition at line 199 of file lam.h.

◆ LamSet

using mim::LamSet = GIDSet<Lam*>

Definition at line 200 of file lam.h.

◆ level_t

using mim::level_t = u64

Definition at line 42 of file types.h.

◆ Meet

using mim::Meet = TBound<false>

Definition at line 179 of file lattice.h.

◆ Mut2Mut

using mim::Mut2Mut = MutMap<Def*>

Definition at line 70 of file def.h.

◆ MutMap

template<class To >
using mim::MutMap = GIDMap<Def*, To>

Definition at line 68 of file def.h.

◆ Muts

using mim::Muts = PooledSet<Def*>

Definition at line 71 of file def.h.

◆ MutSet

using mim::MutSet = GIDSet<Def*>

Definition at line 69 of file def.h.

◆ nat_t

using mim::nat_t = u64

Definition at line 43 of file types.h.

◆ node_t

using mim::node_t = u8

Definition at line 44 of file types.h.

◆ NormalizeFn

using mim::NormalizeFn = Ref (*)(Ref, Ref, Ref)

Definition at line 102 of file def.h.

◆ Normalizers

using mim::Normalizers = absl::flat_hash_map<flags_t, NormalizeFn>

Definition at line 19 of file plugin.h.

◆ Passes

using mim::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.

Definition at line 22 of file plugin.h.

◆ plugin_t

using mim::plugin_t = u64

Definition at line 46 of file types.h.

◆ PostDomTree

using mim::PostDomTree = DomTreeBase<false>

Definition at line 47 of file domtree.h.

◆ s16

using mim::s16 = int16_t

Definition at line 34 of file types.h.

◆ s32

using mim::s32 = int32_t

Definition at line 34 of file types.h.

◆ s64

using mim::s64 = int64_t

Definition at line 34 of file types.h.

◆ s8

using mim::s8 = int8_t

Definition at line 34 of file types.h.

◆ sub_t

using mim::sub_t = u8

Definition at line 48 of file types.h.

◆ tag_t

using mim::tag_t = u8

Definition at line 47 of file types.h.

◆ Top

using mim::Top = TExt<true>

Definition at line 178 of file lattice.h.

◆ u1

using mim::u1 = bool

Definition at line 38 of file types.h.

◆ u16

using mim::u16 = uint16_t

Definition at line 34 of file types.h.

◆ u32

using mim::u32 = uint32_t

Definition at line 34 of file types.h.

◆ u64

using mim::u64 = uint64_t

Definition at line 34 of file types.h.

◆ u8

using mim::u8 = uint8_t

Definition at line 34 of file types.h.

◆ undo_t

using mim::undo_t = size_t

Definition at line 14 of file pass.h.

◆ Uses

using mim::Uses = absl::flat_hash_set<Use, UseHash, UseEq>

Definition at line 136 of file def.h.

◆ Var2Var

using mim::Var2Var = VarMap<const Var*>

Definition at line 79 of file def.h.

◆ VarMap

template<class To >
using mim::VarMap = GIDMap<const Var*, To>

Definition at line 77 of file def.h.

◆ Vars

using mim::Vars = PooledSet<const Var*>

Definition at line 80 of file def.h.

◆ VarSet

using mim::VarSet = GIDSet<const Var*>

Definition at line 78 of file def.h.

◆ View

template<class T , size_t N = std::dynamic_extent>
using mim::View = Span<const T, N>

Definition at line 89 of file span.h.

◆ w2f

template<int w>
using mim::w2f = typename detail::w2f_<w>::type

Definition at line 74 of file types.h.

◆ w2s

template<int w>
using mim::w2s = typename detail::w2s_<w>::type

Definition at line 73 of file types.h.

◆ w2u

template<int w>
using mim::w2u = typename detail::w2u_<w>::type

Definition at line 72 of file types.h.

Enumeration Type Documentation

◆ Dep

enum class mim::Dep : unsigned
strong
Enumerator
None 
Axiom 
Infer 
Mut 
Proxy 
Var 

Definition at line 152 of file def.h.

◆ Sort

enum class mim::Sort
strong
Enumerator
Term 
Type 
Kind 
Space 
Univ 
Level 

Definition at line 139 of file def.h.

Function Documentation

◆ assert_emplace()

template<class C , class... Args>
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().

◆ binary_find()

template<class I , class T , class Cmp >
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().

◆ bitcast()

template<class D , class S >
D mim::bitcast ( const S & src)
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().

◆ collect_args()

std::pair< const Def *, std::vector< const Def * > > mim::collect_args ( const Def * def)

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().

◆ commute()

void mim::commute ( const Def *& a,
const Def *& b )
inline

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().

◆ compose_cn()

const Def * mim::compose_cn ( const Def * f,
const Def * g )

The high level view is:

f: B -> C
g: A -> B
f o g := λ x. f(g(x)) : A -> C

In CPS the types look like:

f: Cn[B, Cn C]
g: Cn[A, Cn B]
h = f o g
h: Cn[A, cn C]
h = λ (a ret_h) = g (a, h')
h': Cn B
h'= λ b = f (b, ret_h)

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().

◆ decurry()

std::deque< const App * > mim::decurry ( const Def * def)

Yields curried Apps in a flat std::deque<const App*>.

Definition at line 44 of file lam.cpp.

Referenced by mim::World::iapp().

◆ erase()

template<class T , size_t N, class A , class U >
Vector< T, N, A >::size_type mim::erase ( Vector< T, N, A > & c,
const U & value )
constexpr

Definition at line 61 of file vector.h.

Referenced by mim::plug::regex::normalize_disj().

◆ erase_if()

template<class T , size_t N, class A , class Pred >
Vector< T, N, A >::size_type mim::erase_if ( Vector< T, N, A > & c,
Pred pred )
constexpr

Definition at line 69 of file vector.h.

◆ errf()

template<class... Args>
std::ostream & mim::errf ( const char * fmt,
Args &&... args )

Definition at line 188 of file print.h.

References fmt(), and print().

Referenced by errln().

◆ errln()

template<class... Args>
std::ostream & mim::errln ( const char * fmt,
Args &&... args )

Definition at line 190 of file print.h.

References errf(), and fmt().

Referenced by main().

◆ error() [1/2]

template<class T = std::logic_error, class... Args>
void mim::error ( const char * fmt,
Args &&... args )

Wraps mim::print to throw T with a formatted message.

Definition at line 162 of file print.h.

References fmt(), and print().

◆ error() [2/2]

◆ find() [1/2]

template<class Indexer , class Key , class Value >
const Value * mim::find ( const IndexMap< Indexer, Key, Value * > & map,
Key key )
inline

Definition at line 73 of file indexmap.h.

References find().

◆ find() [2/2]

template<class Indexer , class Key , class Value >
Value * mim::find ( IndexMap< Indexer, Key, Value * > & map,
Key key )
inline

◆ find_and_replace()

void mim::find_and_replace ( std::string & str,
std::string_view what,
std::string_view repl )
inline

Replaces all occurrences of what with repl.

Definition at line 70 of file util.h.

Referenced by mim::plug::autodiff::AutoDiffEval::augment_().

◆ flatten() [1/2]

const Def * mim::flatten ( const Def * def)

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().

◆ flatten() [2/2]

size_t mim::flatten ( DefVec & ops,
const Def * def,
bool flatten_sigmas = true )

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().

◆ fmt()

template<class... Args>
std::string mim::fmt ( const char * s,
Args &&... args )

◆ force() [1/2]

template<class Id >
auto mim::force ( Id id,
Ref def )

Definition at line 134 of file axiom.h.

References match().

◆ force() [2/2]

template<class Id >
auto mim::force ( Ref def)

◆ get_sign()

template<class T >
bool mim::get_sign ( T val)

Definition at line 40 of file util.h.

◆ hash() [1/2]

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() [2/2]

hash_t mim::hash ( std::string_view s)

Definition at line 11 of file hash.cpp.

References hash_begin(), and hash_combine().

◆ hash_begin() [1/2]

hash_t mim::hash_begin ( )
inline

Definition at line 102 of file hash.h.

References mim::FNV1::offset.

Referenced by hash(), hash(), and mim::UseHash::operator()().

◆ hash_begin() [2/2]

template<class T >
hash_t mim::hash_begin ( T val)

Definition at line 101 of file hash.h.

References hash_combine(), and mim::FNV1::offset.

◆ hash_combine() [1/3]

template<class T >
hash_t mim::hash_combine ( hash_t seed,
T * val )

Definition at line 95 of file hash.h.

References hash_combine().

◆ hash_combine() [2/3]

template<class T >
hash_t mim::hash_combine ( hash_t seed,
T v )

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()().

◆ hash_combine() [3/3]

template<class T , class... Args>
hash_t mim::hash_combine ( hash_t seed,
T val,
Args &&... args )

Definition at line 97 of file hash.h.

References hash_combine().

◆ is_associative() [1/7]

template<class Id >
bool mim::is_associative ( Id id)
constexpr
Warning
By default we assume that any commutative operation is also associative. Please provide a proper specialization if this is not the case.

Definition at line 142 of file axiom.h.

References is_commutative().

◆ is_associative() [2/7]

◆ is_associative() [3/7]

bool mim::is_associative ( plug::core::icmp id)
constexpr

Definition at line 124 of file core.h.

References is_commutative().

◆ is_associative() [4/7]

bool mim::is_associative ( plug::core::nat id)
constexpr

Definition at line 122 of file core.h.

References is_commutative().

◆ is_associative() [5/7]

bool mim::is_associative ( plug::core::ncmp id)
constexpr

Definition at line 123 of file core.h.

References is_commutative().

◆ is_associative() [6/7]

bool mim::is_associative ( plug::core::wrap id)
constexpr

Definition at line 125 of file core.h.

References is_commutative().

◆ is_associative() [7/7]

bool mim::is_associative ( plug::math::arith id)
constexpr

Definition at line 128 of file math.h.

References is_commutative().

◆ is_commutative() [1/9]

◆ is_commutative() [2/9]

bool mim::is_commutative ( plug::core::bit2 id)
constexpr

Definition at line 102 of file core.h.

◆ is_commutative() [3/9]

bool mim::is_commutative ( plug::core::icmp id)
constexpr

Definition at line 99 of file core.h.

References mim::plug::core::ne.

◆ is_commutative() [4/9]

bool mim::is_commutative ( plug::core::nat id)
constexpr

Definition at line 96 of file core.h.

◆ is_commutative() [5/9]

bool mim::is_commutative ( plug::core::ncmp id)
constexpr

Definition at line 97 of file core.h.

References mim::plug::core::ne.

◆ is_commutative() [6/9]

bool mim::is_commutative ( plug::core::wrap id)
constexpr

Definition at line 98 of file core.h.

References mim::plug::core::add, and mim::plug::core::mul.

◆ is_commutative() [7/9]

bool mim::is_commutative ( plug::math::arith id)
constexpr

Definition at line 126 of file math.h.

References mim::plug::math::add, and mim::plug::math::mul.

◆ is_commutative() [8/9]

bool mim::is_commutative ( plug::math::cmp id)
constexpr

Definition at line 127 of file math.h.

◆ is_commutative() [9/9]

bool mim::is_commutative ( plug::math::extrema )
constexpr

Definition at line 125 of file math.h.

◆ is_unit()

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().

◆ isa_apped_mut_lam()

std::pair< const App *, Lam * > mim::isa_apped_mut_lam ( const Def * def)
inline

◆ isa_callee()

const App * mim::isa_callee ( const Def * def,
size_t i )
inline

◆ isa_workable()

Lam * mim::isa_workable ( Lam * lam)
inline

◆ lazy_init()

template<class This , class T >
T & mim::lazy_init ( const This * self,
std::unique_ptr< T > & ptr )
inline

◆ lookup()

template<class C , class K >
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.

Warning
If the element is not already a pointer, this lookup will simply take the address of this element. This means that, e.g., a rehash of an 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().

◆ match() [1/2]

template<class Id , bool DynCast = true>
auto mim::match ( Id id,
Ref def )

Definition at line 122 of file axiom.h.

References mim::Axiom::get().

◆ match() [2/2]

template<class Id , bool DynCast = true>
auto mim::match ( Ref def)
See also
Matching Axioms

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().

◆ merge() [1/2]

DefVec mim::merge ( const Def * def,
Defs defs )

Definition at line 82 of file tuple.cpp.

◆ merge() [2/2]

DefVec mim::merge ( Defs a,
Defs b )

Definition at line 86 of file tuple.cpp.

Referenced by merge_sigma(), and merge_tuple().

◆ merge_sigma()

const Def * mim::merge_sigma ( const Def * def,
Defs defs )

Definition at line 93 of file tuple.cpp.

References mim::Def::isa_imm(), merge(), mim::World::sigma(), and mim::Def::world().

◆ merge_tuple()

const Def * mim::merge_tuple ( const Def * def,
Defs defs )

◆ mim_get_plugin()

MIM_EXPORT mim::Plugin mim::mim_get_plugin ( )

To be implemented and exported by a plugin.

Returns
a filled Plugin.

Referenced by mim::Driver::load().

◆ murmur3() [1/3]

hash_t mim::murmur3 ( hash_t h)
inline

Use for a single value to hash.

Definition at line 62 of file hash.h.

◆ murmur3() [2/3]

hash_t mim::murmur3 ( hash_t h,
uint32_t key )
inline

◆ murmur3() [3/3]

hash_t mim::murmur3 ( hash_t h,
uint64_t key )
inline

Definition at line 29 of file hash.h.

References murmur_32_scramble().

◆ murmur3_finalize()

hash_t mim::murmur3_finalize ( hash_t h,
hash_t len )
inline

Definition at line 51 of file hash.h.

Referenced by mim::Def::Def(), and mim::DefDefHash::operator()().

◆ murmur3_rest() [1/2]

hash_t mim::murmur3_rest ( hash_t h,
uint16_t key )
inline

Definition at line 46 of file hash.h.

References murmur_32_scramble().

◆ murmur3_rest() [2/2]

hash_t mim::murmur3_rest ( hash_t h,
uint8_t key )
inline

Definition at line 41 of file hash.h.

References murmur_32_scramble().

Referenced by mim::Def::Def().

◆ murmur_32_scramble()

hash_t mim::murmur_32_scramble ( hash_t k)
inline

Definition at line 15 of file hash.h.

Referenced by murmur3(), murmur3(), murmur3_rest(), and murmur3_rest().

◆ operator""_f16()

f16 mim::operator""_f16 ( long double d)
inline

Definition at line 88 of file types.h.

◆ operator""_f32()

f32 mim::operator""_f32 ( long double d)
constexpr

Definition at line 89 of file types.h.

◆ operator""_f64()

f64 mim::operator""_f64 ( long double d)
constexpr

Definition at line 90 of file types.h.

◆ operator""_n()

nat_t mim::operator""_n ( unsigned long long int i)
constexpr

Definition at line 87 of file types.h.

◆ operator""_s()

size_t mim::operator""_s ( unsigned long long int i)
constexpr

A size_t literal. Use 0_s to disambiguate 0 from nullptr.

Definition at line 86 of file types.h.

◆ operator""_s16()

s16 mim::operator""_s16 ( unsigned long long int s)
constexpr

Definition at line 82 of file types.h.

◆ operator""_s32()

s32 mim::operator""_s32 ( unsigned long long int s)
constexpr

Definition at line 82 of file types.h.

◆ operator""_s64()

s64 mim::operator""_s64 ( unsigned long long int s)
constexpr

Definition at line 82 of file types.h.

◆ operator""_s8()

s8 mim::operator""_s8 ( unsigned long long int s)
constexpr

Definition at line 82 of file types.h.

◆ operator""_u16()

u16 mim::operator""_u16 ( unsigned long long int u)
constexpr

Definition at line 82 of file types.h.

◆ operator""_u32()

u32 mim::operator""_u32 ( unsigned long long int u)
constexpr

Definition at line 82 of file types.h.

◆ operator""_u64()

u64 mim::operator""_u64 ( unsigned long long int u)
constexpr

Definition at line 82 of file types.h.

◆ operator""_u8()

u8 mim::operator""_u8 ( unsigned long long int u)
constexpr

Definition at line 82 of file types.h.

◆ operator<<() [1/4]

std::ostream & mim::operator<< ( std::ostream & os,
const CFNode * n )

Definition at line 22 of file cfg.cpp.

References mim::CFNode::mut().

◆ operator<<() [2/4]

std::ostream & mim::operator<< ( std::ostream & os,
Ref ref )

Definition at line 418 of file dump.cpp.

◆ operator<<() [3/4]

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().

◆ operator<<() [4/4]

template<bool forward>
std::ostream & mim::operator<< ( std::ostream & os,
const typename LoopTree< forward >::Base * n )

Definition at line 207 of file looptree.cpp.

References print().

◆ optimize()

◆ outf()

template<class... Args>
std::ostream & mim::outf ( const char * fmt,
Args &&... args )

Definition at line 187 of file print.h.

References fmt(), and print().

Referenced by outln().

◆ outln()

template<class... Args>
std::ostream & mim::outln ( const char * fmt,
Args &&... args )

Definition at line 189 of file print.h.

References fmt(), and outf().

◆ pad()

u64 mim::pad ( u64 offset,
u64 align )
inline

Definition at line 49 of file util.h.

Referenced by mim::plug::core::normalize_trait().

◆ pop() [1/2]

template<class Q >
auto mim::pop ( Q & q) -> decltype(q.front(), typename Q::value_type())

Definition at line 84 of file util.h.

◆ pop() [2/2]

template<class S >
auto mim::pop ( S & s) -> decltype(s.top(), typename S::value_type())

◆ print() [1/2]

◆ print() [2/2]

template<class T , class... Args>
std::ostream & mim::print ( std::ostream & os,
const char * s,
T && t,
Args &&... args )

Definition at line 92 of file print.h.

References print().

◆ println()

template<class... 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().

◆ register_pass()

template<class A , class P , class... CArgs>
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().

◆ register_pass_with_arg()

template<class A , class P , class Q >
void mim::register_pass_with_arg ( Passes & passes)

◆ register_phase()

template<class A , class P , class... CArgs>
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().

◆ rem() [1/4]

double mim::rem ( double a,
double b )
inline

Definition at line 97 of file types.h.

◆ rem() [2/4]

float mim::rem ( float a,
float b )
inline

Definition at line 96 of file types.h.

◆ rem() [3/4]

half mim::rem ( half a,
half b )
inline

Definition at line 95 of file types.h.

Referenced by mim::BitSet::operator>>=().

◆ rem() [4/4]

long double mim::rem ( long double a,
long double b )
inline

Definition at line 98 of file types.h.

◆ rewrite() [1/3]

DefVec mim::rewrite ( Def * mut,
Ref arg )

◆ rewrite() [2/3]

Ref mim::rewrite ( Ref def,
Def * mut,
Ref arg )
inline

As above but rewrites def.

Definition at line 69 of file rewrite.h.

References mim::Rewriter::rewrite(), and mim::Def::var().

◆ rewrite() [3/3]

Ref mim::rewrite ( size_t i,
Def * mut,
Ref arg )
inline

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().

◆ Span() [1/7]

template<class T , size_t N>
mim::Span ( const std::array< T, N > & ) -> Span< const T, N >

◆ Span() [2/7]

template<Vectorlike Vec>
mim::Span ( const Vec & ) -> Span< const typename Vec::value_type, std::dynamic_extent >

◆ Span() [3/7]

template<class I , class E >
mim::Span ( I ,
E  ) -> Span< std::remove_reference_t< std::iter_reference_t< I > > >

◆ Span() [4/7]

template<class R >
mim::Span ( R && ) -> Span< std::remove_reference_t< std::ranges::range_reference_t< R > > >

◆ Span() [5/7]

template<class T , size_t N>
mim::Span ( std::array< T, N > & ) -> Span< T, N >

◆ Span() [6/7]

template<class T , size_t N>
mim::Span ( T(&) [N]) -> Span< T, N >

◆ Span() [7/7]

template<Vectorlike Vec>
mim::Span ( Vec & ) -> Span< typename Vec::value_type, std::dynamic_extent >

◆ subview()

std::string_view mim::subview ( std::string_view s,
size_t i,
size_t n = std::string_view::npos )
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().

◆ tuple2str()

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().

◆ tuple_of_types()

Ref mim::tuple_of_types ( Ref t)

Definition at line 109 of file tuple.cpp.

Referenced by mim::plug::mem::op_lea().

◆ unflatten() [1/2]

const Def * mim::unflatten ( const Def * def,
const Def * type )

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().

◆ unflatten() [2/2]

const Def * mim::unflatten ( Defs ops,
const Def * type,
bool flatten_muts = true )

Same as unflatten, but uses the operands of a flattened Pack / Tuple directly.

Definition at line 73 of file tuple.cpp.

References unflatten().

◆ Vector()

template<class I , class A = std::allocator<typename std::iterator_traits<I>::value_type>>
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 >

◆ visit()

template<class Indexer , class Key >
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().

◆ visit_first()

template<class Indexer , class Key >
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().

Variable Documentation

◆ Default_Inlined_Size

template<class T >
size_t mim::Default_Inlined_Size = std::max((size_t)1, 4 * sizeof(size_t) / sizeof(T))
staticconstexpr

Definition at line 9 of file vector.h.

◆ No_Undo

◆ SizeOf

template<class T >
size_t mim::SizeOf = sizeof(std::conditional_t<std::is_pointer_v<T>, uintptr_t, T>)
inlinestaticconstexpr

Definition at line 14 of file pool.h.