Thorin 1.9.0
The Higher ORder INtermediate representation
|
Namespaces | |
namespace | affine |
The affine Plugin | |
namespace | autodiff |
The automatic differentiation Plugin | |
namespace | clos |
The clos Plugin | |
namespace | compile |
The compile Plugin | |
namespace | core |
The core Plugin | |
namespace | demo |
The demo Plugin | |
namespace | direct |
The direct style Plugin | |
namespace | dl |
namespace | dot |
namespace | fe |
namespace | ll |
namespace | math |
The math Plugin | |
namespace | matrix |
The matrix Dialect | |
namespace | mem |
The mem Plugin | |
namespace | Node |
namespace | opt |
The opt Plugin | |
namespace | refly |
The refly Plugin | |
namespace | regex |
The regex Plugin | |
namespace | sys |
namespace | utf8 |
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 | Array |
A container for an array, either heap-allocated or stack allocated. More... | |
class | ArrayStorage |
struct | ArrayStorage< T, 0 > |
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... | |
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 |
Use with print to output complicated std::ranges::range s. More... | |
class | Emitter |
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 |
Magic numbers for FNV-1 hash. More... | |
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 |
struct | Loc |
Location in a File. More... | |
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... | |
struct | Pos |
class | Proxy |
class | Ref |
Helper class to retrieve Infer::arg if present. More... | |
class | RetWrap |
class | Rewriter |
Recurseivly rewrites part of a program into the provided World. More... | |
class | RuntimeCast |
Inherit from this class using CRTP, for some nice dynamic_cast -style wrappers. More... | |
class | RWPass |
Inherit from this class 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 | Scalerize |
Perform Scalarization (= Argument simplification), i.e.: 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 | ScopeRewriter |
Stops rewriting when leaving the Scope. More... | |
class | Sigma |
A dependent tuple type. More... | |
class | Singleton |
A singleton wraps a type into a higher order type. More... | |
class | Span |
A container-like wrapper for an array. More... | |
class | Sym |
A Symbol just wraps a const std::string* , so pass Sym itself around as value. More... | |
class | SymPool |
Hash set where all strings - wrapped in Symbol - live in. 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 | Vel |
Constructs a Join value. More... | |
class | World |
The World represents the whole program and manages creation of Thorin nodes (Defs). More... | |
Concepts | |
concept | annex_with_subs |
concept | annex_without_subs |
Typedefs | |
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 = Span< const Def * > |
using | DefArray = Array< 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 * > |
DefDef | |
using | DefDef = std::tuple< const Def *, const Def * > |
using | DefVec = std::vector< 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 |
Sym | |
Set/Map is keyed by pointer - which is hashed in SymPool. | |
template<class V > | |
using | SymMap = absl::flat_hash_map< Sym, V > |
using | SymSet = absl::flat_hash_set< Sym > |
using | Syms = std::deque< Sym > |
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 > > |
Functions | |
void | bootstrap (Driver &driver, Sym plugin, std::ostream &h) |
void | optimize (World &world) |
is_commutative/is_associative | |
constexpr bool | is_commutative (core::nat id) |
constexpr bool | is_commutative (core::ncmp id) |
constexpr bool | is_commutative (core::wrap id) |
constexpr bool | is_commutative (core::icmp id) |
constexpr bool | is_commutative (core::bit2 id) |
constexpr bool | is_associative (core::bit2 id) |
constexpr bool | is_commutative (math::extrema) |
constexpr bool | is_commutative (math::arith id) |
constexpr bool | is_commutative (math::cmp id) |
template<class Id > | |
constexpr bool | is_commutative (Id) |
template<class Id > | |
constexpr bool | is_associative (Id id) |
std::ostream operator | |
std::ostream & | operator<< (std::ostream &os, const CFNode *n) |
template<bool forward> | |
std::ostream & | operator<< (std::ostream &os, const typename LoopTree< forward >::Base *n) |
std::ostream & | operator<< (std::ostream &os, const Def *def) |
This will stream def as an operand. More... | |
std::ostream & | operator<< (std::ostream &, Ref) |
std::ostream & | operator<< (std::ostream &os, const Pos pos) |
std::ostream & | operator<< (std::ostream &os, const Loc loc) |
std::ostream & | operator<< (std::ostream &o, const Sym sym) |
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) |
Formatted Output | |
Provides a Use
| |
template<class T = std::logic_error, class... Args> | |
void | error (const Def *def, const char *fmt, Args &&... args) |
template<class T = std::logic_error, class... Args> | |
void | error (Loc loc, const char *fmt, Args &&... args) |
std::ostream & | print (std::ostream &os, const char *s) |
Base case. More... | |
template<class T , class... Args> | |
std::ostream & | print (std::ostream &os, const char *s, T &&t, Args &&... args) |
template<class... Args> | |
std::string | fmt (const char *s, Args &&... args) |
Wraps thorin::print to output a formatted std:string . More... | |
template<class T = std::logic_error, class... Args> | |
void | error (const char *fmt, Args &&... args) |
Wraps thorin::print to throw T with a formatted message. More... | |
Helpers to work with Functions | |
std::deque< const App * > | decurry (const Def *) |
Yields curried Apps in a flat std::deque<const App*> . More... | |
const Def * | compose_cn (const Def *f, const Def *g) |
The high level view is: More... | |
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. More... | |
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. More... | |
std::pair< const App *, Lam * > | isa_apped_mut_lam (const Def *def) |
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 | |
Ref | rewrite (Ref def, Ref old_def, Ref new_def, const Scope &scope) |
Ref | rewrite (Def *mut, Ref arg, size_t i, const Scope &scope) |
Same as above but uses scope as an optimization instead of computing a new Scope. More... | |
Ref | rewrite (Def *mut, Ref arg, size_t i) |
Rewrites mut's i^th op by substituting mut's Var with arg while obeying mut's scope . More... | |
DefArray | rewrite (Def *mut, Ref arg, const Scope &scope) |
Same as above but uses scope as an optimization instead of computing a new Scope. More... | |
DefArray | rewrite (Def *mut, Ref arg) |
Rewrites mut's ops by substituting mut's Var with arg while obeying mut's scope . More... | |
Helpers to work with Tulpes/Sigmas/Arrays/Packs | |
bool | is_unit (const Def *def) |
std::string | tuple2str (const Def *def) |
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. More... | |
const Def * | flatten (const Def *def) |
Flattens a sigma/array/pack/tuple. More... | |
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. More... | |
const Def * | unflatten (const Def *def, const Def *type) |
Applies the reverse transformation on a pack/tuple, given the original type. More... | |
DefArray | merge (const Def *def, Defs defs) |
DefArray | merge (Defs a, Defs b) |
const Def * | merge_sigma (const Def *def, Defs defs) |
const Def * | merge_tuple (const Def *def, Defs defs) |
Ref | tuple_of_types (Ref t) |
Array/ArrayRef Helpers | |
template<class T , class U > | |
auto | concat (const T &a, const U &b) -> Array< typename T::value_type > |
template<class T > | |
auto | concat (const T &val, Span< T > a) -> Array< T > |
template<class T > | |
auto | concat (Span< T > a, const T &val) -> Array< T > |
template<class T > | |
Array< typename T::value_type > | make_array (const T &container) |
Debug Helpers | |
void | unreachable () |
void | breakpoint () |
String Hashing | |
hash_t | hash (const char *s) |
hash_t | hash (std::string_view s) |
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. More... | |
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 . More... | |
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 () |
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 | |
thorin::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) |
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 . More... | |
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 . More... | |
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. More... | |
void | find_and_replace (std::string &str, std::string_view what, std::string_view repl) |
Replaces all occurrences of what with repl . More... | |
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. More... | |
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. More... | |
Var | |
GIDSet / GIDMap keyed by Var::gid of | |
enum class | Sort { Term , Type , Kind , Space , Univ , Level } |
template<class To > | |
using | VarMap = GIDMap< const Var *, To > |
using | VarSet = GIDSet< const Var * > |
using | Var2Var = VarMap< const Var * > |
using | NormalizeFn = Ref(*)(Ref, Ref, Ref) |
using | Uses = absl::flat_hash_set< Use, UseHash, UseEq > |
Dep | |
enum class | Dep : unsigned { None = 0 , Axiom = 1 << 0 , Infer = 1 << 1 , Mut = 1 << 2 , Proxy = 1 << 3 , Var = 1 << 4 } |
constexpr auto | operator& (Dep x, Dep y) |
constexpr auto | operator& (std::underlying_type_t< Dep > x, Dep y) |
constexpr auto | operator& (Dep x, std::underlying_type_t< Dep > y) |
constexpr auto | operator| (Dep x, Dep y) |
constexpr auto | operator| (std::underlying_type_t< Dep > x, Dep y) |
constexpr auto | operator| (Dep x, std::underlying_type_t< Dep > y) |
constexpr auto | operator^ (Dep x, Dep y) |
constexpr auto | operator^ (std::underlying_type_t< Dep > x, Dep y) |
constexpr auto | operator^ (Dep x, std::underlying_type_t< Dep > y) |
constexpr std::strong_ordering | operator<=> (std::underlying_type_t< Dep > x, Dep y) |
constexpr std::strong_ordering | operator<=> (Dep x, std::underlying_type_t< Dep > y) |
constexpr bool | operator== (std::underlying_type_t< Dep > x, Dep y) |
constexpr bool | operator== (Dep x, std::underlying_type_t< Dep > y) |
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. More... | |
using | Backends = absl::btree_map< std::string, void(*)(World &, std::ostream &)> |
THORIN_EXPORT thorin::Plugin | thorin_get_plugin () |
To be implemented and exported by a plugin. More... | |
struct thorin::Flags |
Compiler switches that must be saved and looked up in later phases of compilation.
using thorin::B_CFG = typedef CFG<false> |
using thorin::Backends = typedef absl::btree_map<std::string, void (*)(World&, std::ostream&)> |
using thorin::Bot = typedef TExt<false> |
using thorin::CFNodes = typedef GIDSet<const CFNode*> |
using thorin::ControlDeps = typedef DomFrontierBase<false> |
Definition at line 44 of file domfrontier.h.
using thorin::Def2Def = typedef DefMap<const Def*> |
using thorin::DefArray = typedef Array<const Def*> |
using thorin::DefDef = typedef std::tuple<const Def*, const Def*> |
using thorin::DefDefMap = typedef absl::flat_hash_map<DefDef, To, DefDefHash, DefDefEq> |
using thorin::DefDefSet = typedef absl::flat_hash_set<DefDef, DefDefHash, DefDefEq> |
using thorin::DefMap = typedef GIDMap<const Def*, To> |
using thorin::Defs = typedef Span<const Def*> |
using thorin::DefSet = typedef GIDSet<const Def*> |
using thorin::DefVec = typedef std::vector<const Def*> |
using thorin::DomFrontiers = typedef DomFrontierBase<true> |
Definition at line 43 of file domfrontier.h.
typedef DomTreeBase< true > thorin::DomTree |
using thorin::f16 = typedef half |
using thorin::f32 = typedef float |
using thorin::f64 = typedef double |
using thorin::F_CFG = typedef CFG<true> |
using thorin::flags_t = typedef u64 |
using thorin::GIDMap = typedef absl::flat_hash_map<K, V, GIDHash<K>, GIDEq<K> > |
using thorin::GIDNodeMap = typedef absl::node_hash_map<K, V, GIDHash<K>, GIDEq<K> > |
using thorin::GIDNodeSet = typedef absl::node_hash_set<K, GIDHash<K>, GIDEq<K> > |
using thorin::GIDSet = typedef absl::flat_hash_set<K, GIDHash<K>, GIDEq<K> > |
using thorin::hash_t = typedef uint32_t |
using thorin::Join = typedef TBound<true> |
using thorin::Lam2Lam = typedef LamMap<Lam*> |
using thorin::LamMap = typedef GIDMap<Lam*, To> |
using thorin::LamSet = typedef GIDSet<Lam*> |
using thorin::level_t = typedef u64 |
using thorin::Meet = typedef TBound<false> |
using thorin::Mut2Mut = typedef MutMap<Def*> |
using thorin::MutMap = typedef GIDMap<Def*, To> |
using thorin::MutSet = typedef GIDSet<Def*> |
using thorin::nat_t = typedef u64 |
using thorin::node_t = typedef u8 |
using thorin::Normalizers = typedef absl::flat_hash_map<flags_t, NormalizeFn> |
using thorin::Passes = typedef absl::flat_hash_map<flags_t, std::function<void(World&, PipelineBuilder&, const Def*)> > |
using thorin::plugin_t = typedef u64 |
using thorin::PostDomTree = typedef DomTreeBase<false> |
using thorin::s16 = typedef int16_t |
using thorin::s32 = typedef int32_t |
using thorin::s64 = typedef int64_t |
using thorin::s8 = typedef int8_t |
using thorin::sub_t = typedef u8 |
using thorin::SymMap = typedef absl::flat_hash_map<Sym, V> |
using thorin::Syms = typedef std::deque<Sym> |
using thorin::SymSet = typedef absl::flat_hash_set<Sym> |
using thorin::tag_t = typedef u8 |
using thorin::Top = typedef TExt<true> |
using thorin::u1 = typedef bool |
using thorin::u16 = typedef uint16_t |
using thorin::u32 = typedef uint32_t |
using thorin::u64 = typedef uint64_t |
using thorin::u8 = typedef uint8_t |
using thorin::undo_t = typedef size_t |
using thorin::Uses = typedef absl::flat_hash_set<Use, UseHash, UseEq> |
using thorin::Var2Var = typedef VarMap<const Var*> |
using thorin::VarMap = typedef GIDMap<const Var*, To> |
using thorin::VarSet = typedef GIDSet<const Var*> |
using thorin::w2f = typedef typename detail::w2f_<w>::type |
using thorin::w2s = typedef typename detail::w2s_<w>::type |
using thorin::w2u = typedef typename detail::w2u_<w>::type |
|
strong |
|
strong |
auto thorin::assert_emplace | ( | C & | container, |
Args &&... | args | ||
) |
Invokes emplace
on container
, asserts that insertion actually happened, and returns the iterator.
Definition at line 110 of file util.h.
References assert_unused.
Referenced by thorin::Driver::load(), thorin::World::make_external(), thorin::World::register_annex(), register_pass(), register_pass_with_arg(), register_phase(), thorin::Scheduler::Scheduler(), thorin_get_plugin(), and thorin::fe::TuplePtrn::type().
I thorin::binary_find | ( | I | begin, |
I | end, | ||
T | val, | ||
Cmp | cmp | ||
) |
Definition at line 62 of file util.h.
Referenced by thorin::Bound::find().
|
inline |
A bitcast from src
of type S
to D
.
Definition at line 28 of file util.h.
Referenced by thorin::ll::Emitter::emit_bb().
Definition at line 11 of file bootstrap.cpp.
References thorin::Annex::mangle(), thorin::Driver::plugin2annxes(), print(), and thorin::Tab::print().
Referenced by main(), and thorin::fe::Parser::plugin().
|
inline |
Definition at line 27 of file assert.h.
Referenced by thorin::Log::log().
Helper function to cope with the fact that normalizers take all arguments and not only its axiom arguments.
Definition at line 89 of file lam.cpp.
References collect_args(), and thorin::RuntimeCast< B >::isa().
Referenced by collect_args(), thorin::compile::handle_optimization_part(), thorin::compile::normalize_combine_pass_list(), thorin::compile::normalize_combined_phase(), thorin::compile::normalize_pass_phase(), optimize(), and thorin_get_plugin().
The high level view is:
In CPS the types look like:
Definition at line 53 of file lam.cpp.
References thorin::Pi::dom(), H, thorin::Pi::isa_returning(), and thorin::Pi::ret_dom().
Referenced by thorin::autodiff::AutoDiffEval::augment_app().
auto thorin::concat | ( | const T & | a, |
const U & | b | ||
) | -> Array<typename T::value_type> |
Definition at line 388 of file array.h.
References thorin::Array< T >::begin().
Definition at line 395 of file array.h.
References thorin::Array< T >::begin(), and thorin::Array< T >::front().
Definition at line 403 of file array.h.
References thorin::Array< T >::back(), and thorin::Array< T >::begin().
Yields curried Apps in a flat std::deque<const App*>
.
Definition at line 44 of file lam.cpp.
References thorin::RuntimeCast< B >::isa().
Referenced by thorin::World::iapp().
std::ostream & thorin::errf | ( | const char * | fmt, |
Args &&... | args | ||
) |
std::ostream & thorin::errln | ( | const char * | fmt, |
Args &&... | args | ||
) |
void thorin::error | ( | const char * | fmt, |
Args &&... | args | ||
) |
Wraps thorin::print to throw T
with a formatted message.
void thorin::error | ( | const Def * | def, |
const char * | fmt, | ||
Args &&... | args | ||
) |
Definition at line 544 of file def.h.
References error(), fmt(), and thorin::Def::loc().
Referenced by thorin::World::annex(), thorin::World::app(), thorin::World::arr(), thorin::fe::Scopes::bind(), thorin::Pi::check(), thorin::Lam::check(), thorin::Arr::check(), thorin::dl::close(), thorin::ll::compile_and_run(), thorin::ll::Emitter::emit_bb(), error(), thorin::sys::exec(), thorin::World::extract(), thorin::fe::Scopes::find(), thorin::dl::get(), thorin::fe::Parser::import(), thorin::World::insert(), thorin::fe::Lexer::lex(), thorin::World::lit(), thorin::Driver::load(), main(), thorin::Driver::name2annex(), thorin::dl::open(), optimize(), thorin::World::pack(), thorin::World::tuple(), thorin::World::type(), thorin::fe::TuplePtrn::type(), thorin::World::uinc(), and thorin::World::umax().
void thorin::error | ( | Loc | loc, |
const char * | fmt, | ||
Args &&... | args | ||
) |
|
inline |
Definition at line 76 of file indexmap.h.
References find().
|
inline |
Definition at line 70 of file indexmap.h.
References thorin::IndexMap< Indexer, Key, Value >::array(), and thorin::IndexMap< Indexer, Key, Value >::indexer().
Referenced by find(), and thorin::LoopTree< forward >::operator[]().
|
inline |
Replaces all occurrences of what
with repl
.
Definition at line 74 of file util.h.
Referenced by thorin::autodiff::AutoDiffEval::augment_().
Flattens a sigma/array/pack/tuple.
Definition at line 67 of file tuple.cpp.
References flatten(), thorin::Def::is_term(), thorin::World::sigma(), thorin::World::tuple(), thorin::Def::type(), and thorin::Def::world().
Same as unflatten, but uses the operands of a flattened pack/tuple directly.
Definition at line 56 of file tuple.cpp.
References flatten(), thorin::Def::isa_lit_arity(), and thorin::Def::proj().
Referenced by flatten(), and thorin::Scalerize::rewrite().
std::string thorin::fmt | ( | const char * | s, |
Args &&... | args | ||
) |
Wraps thorin::print to output a formatted std:string
.
Definition at line 143 of file print.h.
References print().
Referenced by thorin::ll::compile(), errf(), errln(), error(), thorin::Log::log(), outf(), and outln().
hash_t thorin::hash | ( | const char * | s | ) |
Definition at line 5 of file hash.cpp.
References hash_begin(), and hash_combine().
Referenced by thorin::DefDefHash::operator()().
hash_t thorin::hash | ( | std::string_view | s | ) |
Definition at line 11 of file hash.cpp.
References hash_begin(), and hash_combine().
|
inline |
Definition at line 111 of file hash.h.
References thorin::FNV1::offset.
Referenced by hash(), and thorin::UseHash::operator()().
hash_t thorin::hash_begin | ( | T | val | ) |
Definition at line 108 of file hash.h.
References hash_combine(), and thorin::FNV1::offset.
Definition at line 98 of file hash.h.
References hash_combine().
Returns a new hash by combining the hash seed
with val
.
Definition at line 84 of file hash.h.
References thorin::FNV1::prime.
Referenced by hash(), hash_begin(), hash_combine(), and thorin::UseHash::operator()().
hash_t thorin::hash_combine | ( | hash_t | seed, |
T | val, | ||
Args &&... | args | ||
) |
Definition at line 103 of file hash.h.
References hash_combine().
|
constexpr |
Definition at line 111 of file core.h.
References thorin::core::and_, thorin::core::fst, thorin::core::nxor, thorin::core::or_, thorin::core::snd, and thorin::core::xor_.
|
constexpr |
Definition at line 139 of file axiom.h.
References is_commutative().
|
constexpr |
|
constexpr |
Definition at line 103 of file core.h.
References thorin::core::ne.
|
constexpr |
Definition at line 100 of file core.h.
Referenced by is_associative().
|
constexpr |
|
constexpr |
Definition at line 102 of file core.h.
References thorin::core::add, and thorin::core::mul.
|
constexpr |
|
constexpr |
Definition at line 129 of file math.h.
References thorin::math::mul.
|
constexpr |
|
constexpr |
bool thorin::is_unit | ( | const Def * | def | ) |
Definition at line 47 of file tuple.cpp.
References thorin::World::sigma(), thorin::Def::type(), and thorin::Def::world().
Definition at line 233 of file lam.h.
References thorin::RuntimeCast< B >::isa().
Definition at line 225 of file lam.h.
References thorin::RuntimeCast< B >::isa().
These are Lams that are neither nullptr
, nor Lam::is_external, nor Lam::is_unset.
Definition at line 228 of file lam.h.
References thorin::Def::is_external(), and thorin::Def::is_set().
|
inline |
Definition at line 22 of file util.h.
Referenced by thorin::CFA::b_cfg(), thorin::Scope::cfa(), thorin::CFG< forward >::domfrontier(), thorin::CFG< forward >::domtree(), thorin::CFA::f_cfg(), and thorin::CFG< forward >::looptree().
auto thorin::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 thorin::Driver::backend(), thorin::World::external(), thorin::Driver::is_loaded(), thorin::EtaExp::new2old(), thorin::Driver::normalizer(), and thorin::Driver::pass().
Array< typename T::value_type > thorin::make_array | ( | const T & | container | ) |
auto thorin::match | ( | Id | id, |
Ref | def | ||
) |
Definition at line 119 of file axiom.h.
References thorin::RuntimeCast< B >::as(), and thorin::Axiom::get().
auto thorin::match | ( | Ref | def | ) |
Definition at line 108 of file axiom.h.
References thorin::RuntimeCast< B >::as(), and thorin::Axiom::get().
Referenced by thorin::regex::equals_any(), thorin::regex::normalize_quant(), thorin::refly::RemoveDbgPerm::rewrite(), thorin::regex::LowerRegex::rewrite(), thorin::Lam::test(), and thorin::World::test().
Definition at line 83 of file tuple.cpp.
References thorin::Span< T >::size().
Referenced by merge_sigma(), and merge_tuple().
Definition at line 87 of file tuple.cpp.
References thorin::Array< T >::begin(), and thorin::Span< T >::size().
Definition at line 94 of file tuple.cpp.
References thorin::Def::isa_imm(), merge(), thorin::World::sigma(), and thorin::Def::world().
Definition at line 99 of file tuple.cpp.
References thorin::Def::isa_imm(), merge(), thorin::World::tuple(), thorin::Def::type(), and thorin::Def::world().
Definition at line 22 of file hash.h.
References murmur_32_scramble().
Referenced by thorin::Def::Def(), thorin::DefDefHash::operator()(), and thorin::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 thorin::Def::Def(), and thorin::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 thorin::Def::Def().
Definition at line 15 of file hash.h.
Referenced by murmur3(), and murmur3_rest().
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
std::ostream & thorin::operator<< | ( | std::ostream & | os, |
Ref | ref | ||
) |
|
inline |
std::ostream & thorin::operator<< | ( | std::ostream & | os, |
const CFNode * | n | ||
) |
Definition at line 25 of file cfg.cpp.
References thorin::CFNode::mut().
std::ostream & thorin::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 332 of file dump.cpp.
References thorin::Def::world().
std::ostream & thorin::operator<< | ( | std::ostream & | os, |
const Loc | loc | ||
) |
Definition at line 13 of file loc.cpp.
References thorin::Loc::begin, thorin::Pos::col, thorin::Loc::finis, thorin::Loc::path, and thorin::Pos::row.
std::ostream & thorin::operator<< | ( | std::ostream & | os, |
const Pos | pos | ||
) |
Definition at line 5 of file loc.cpp.
References thorin::Pos::col, and thorin::Pos::row.
std::ostream & thorin::operator<< | ( | std::ostream & | os, |
const typename LoopTree< forward >::Base * | n | ||
) |
Definition at line 211 of file looptree.cpp.
References print(), and unreachable().
void thorin::optimize | ( | World & | world | ) |
Definition at line 19 of file optimize.cpp.
References thorin::RuntimeCast< B >::as(), collect_args(), thorin::World::driver(), error(), thorin::World::external(), thorin::World::externals(), thorin::Def::flags(), thorin::Def::make_internal(), thorin::Lam::num_doms(), thorin::Driver::pass(), thorin::PipelineBuilder::run_pipeline(), thorin::World::sym(), and thorin::Def::type().
Referenced by main().
std::ostream & thorin::outf | ( | const char * | fmt, |
Args &&... | args | ||
) |
std::ostream & thorin::outln | ( | const char * | fmt, |
Args &&... | args | ||
) |
Definition at line 52 of file util.h.
Referenced by thorin::core::normalize_trait().
auto thorin::pop | ( | Q & | q | ) | -> decltype(q.front(), typename Q::value_type()) |
auto thorin::pop | ( | S & | s | ) | -> decltype(s.top(), typename S::value_type()) |
Definition at line 83 of file util.h.
Referenced by thorin::CFA::CFA(), thorin::unique_stack< Set >::pop(), thorin::unique_queue< Set >::pop(), and thorin::PassMan::run().
std::ostream & thorin::print | ( | std::ostream & | os, |
const char * | s | ||
) |
Base case.
Definition at line 5 of file print.cpp.
References unreachable().
Referenced by thorin::ll::BB::assign(), bootstrap(), thorin::ll::Emitter::declare(), thorin::World::dump(), thorin::ll::Emitter::emit_bb(), thorin::dot::Emitter::emit_bb(), thorin::ll::Emitter::emit_epilogue(), thorin::dot::Emitter::emit_epilogue(), thorin::ll::Emitter::emit_imported(), thorin::dot::Emitter::emit_imported(), errf(), error(), thorin::ll::Emitter::finalize(), fmt(), thorin::Log::log(), operator<<(), outf(), thorin::ll::Emitter::prepare(), thorin::Tab::print(), print(), and thorin::ll::BB::tail().
std::ostream & thorin::print | ( | std::ostream & | os, |
const char * | s, | ||
T && | t, | ||
Args &&... | args | ||
) |
Definition at line 96 of file print.h.
References print(), and unreachable().
void thorin::register_pass | ( | Passes & | passes, |
CArgs &&... | args | ||
) |
Definition at line 51 of file pipelinebuilder.h.
References thorin::PipelineBuilder::add_pass(), and assert_emplace().
void thorin::register_pass_with_arg | ( | Passes & | passes | ) |
Definition at line 67 of file pipelinebuilder.h.
References thorin::PipelineBuilder::add_pass(), thorin::App::arg(), thorin::RuntimeCast< B >::as(), assert_emplace(), thorin::Def::gid(), and thorin::PipelineBuilder::pass().
void thorin::register_phase | ( | Passes & | passes, |
CArgs &&... | args | ||
) |
Definition at line 59 of file pipelinebuilder.h.
References thorin::PipelineBuilder::add_phase(), and assert_emplace().
|
inline |
Definition at line 92 of file types.h.
Referenced by thorin::BitSet::operator>>=().
|
inline |
Rewrites mut's
ops by substituting mut's
Var
with arg
while obeying mut's
scope
.
Definition at line 65 of file rewrite.cpp.
References rewrite().
Same as above but uses scope
as an optimization instead of computing a new Scope.
Definition at line 59 of file rewrite.cpp.
References thorin::Rewriter::map(), thorin::Def::num_ops(), and thorin::Def::var().
Rewrites mut's
i^th
op by substituting mut's
Var
with arg
while obeying mut's
scope
.
Definition at line 54 of file rewrite.cpp.
References rewrite().
Same as above but uses scope
as an optimization instead of computing a new Scope.
Definition at line 52 of file rewrite.cpp.
References thorin::Def::op(), rewrite(), and thorin::Def::var().
Definition at line 46 of file rewrite.cpp.
References thorin::Rewriter::map(), and thorin::ScopeRewriter::rewrite().
Referenced by thorin::World::extract(), thorin::direct::op_cps2ds_dep(), thorin::Def::reduce(), thorin::Arr::reduce(), thorin::Pack::reduce(), and rewrite().
|
inline |
Like std::string::substr
, but works on std::string_view
instead.
Definition at line 68 of file util.h.
Referenced by thorin::Annex::split().
THORIN_EXPORT thorin::Plugin thorin::thorin_get_plugin | ( | ) |
To be implemented and exported by a plugin.
Referenced by thorin::Driver::load().
std::string thorin::tuple2str | ( | const Def * | def | ) |
Definition at line 49 of file tuple.cpp.
References thorin::Def::arity(), thorin::RuntimeCast< Def >::as(), and thorin::Def::projs().
Definition at line 110 of file tuple.cpp.
Referenced by thorin::mem::op_lea().
Applies the reverse transformation on a pack/tuple, given the original type.
Definition at line 81 of file tuple.cpp.
References thorin::Def::arity(), thorin::RuntimeCast< Def >::as(), thorin::Def::projs(), and unflatten().
Same as unflatten, but uses the operands of a flattened pack/tuple directly.
Definition at line 74 of file tuple.cpp.
References thorin::Span< T >::size(), and unflatten().
Referenced by unflatten().
|
inline |
Definition at line 21 of file assert.h.
Referenced by thorin::ll::Emitter::emit_bb(), thorin::Log::level2acro(), thorin::Log::level2color(), thorin::math::lit_f(), thorin::Def::node_name(), thorin::core::normalize_trait(), operator<<(), thorin::fe::Tok::prec(), print(), thorin::Infer::rebuild(), thorin::Global::rebuild(), thorin::Def::stub(), thorin::TExt< Up >::stub(), thorin::fe::Tok::tag2str(), and thorin::Def::var().
bool thorin::visit | ( | IndexSet< Indexer, Key > & | set, |
const Key & | key | ||
) |
Definition at line 104 of file indexset.h.
References thorin::IndexSet< Indexer, Key >::insert().
Referenced by visit_first().
void thorin::visit_first | ( | IndexSet< Indexer, Key > & | set, |
const Key & | key | ||
) |
Definition at line 109 of file indexset.h.
References thorin::IndexSet< Indexer, Key >::contains(), and visit().
Definition at line 15 of file pass.h.
Referenced by thorin::Pass::analyze(), thorin::PassMan::run(), thorin::FPPass< P, N >::undo_enter(), and thorin::FPPass< P, N >::undo_visit().