Thorin 1.9.0
The Higher ORder INtermediate representation
Loading...
Searching...
No Matches
thorin Namespace Reference

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 swapping 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::ranges. 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 conset Def*.

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 Def*.

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 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
 
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 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 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 Defcompose_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 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. 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 def by mapping old_def to new_def while obeying scope.

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 Defflatten (const Def *def)
 Flattens a sigma/array/pack/tuple. More...
 
const Defunflatten (Defs ops, const Def *type, bool flatten_muts=true)
 Same as unflatten, but uses the operands of a flattened pack/tuple directly. More...
 
const Defunflatten (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 Defmerge_sigma (const Def *def, Defs defs)
 
const Defmerge_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 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)
 
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 >
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 >
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 const Var*.

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

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

Class Documentation

◆ thorin::Dbg

struct thorin::Dbg

Definition at line 81 of file loc.h.

Class Members
Loc loc
Sym sym

◆ thorin::Flags

struct thorin::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 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 scalerize_threshold = 32
bool trace_gids = false

Typedef Documentation

◆ B_CFG

using thorin::B_CFG = typedef CFG<false>

Definition at line 16 of file scope.h.

◆ Backends

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

Definition at line 23 of file plugin.h.

◆ Bot

using thorin::Bot = typedef TExt<false>

Definition at line 144 of file lattice.h.

◆ CFNodes

using thorin::CFNodes = typedef GIDSet<const CFNode*>

Definition at line 22 of file cfg.h.

◆ ControlDeps

using thorin::ControlDeps = typedef DomFrontierBase<false>

Definition at line 44 of file domfrontier.h.

◆ Def2Def

using thorin::Def2Def = typedef DefMap<const Def*>

Definition at line 52 of file def.h.

◆ DefArray

using thorin::DefArray = typedef Array<const Def*>

Definition at line 54 of file def.h.

◆ DefDef

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

Definition at line 551 of file def.h.

◆ DefDefMap

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

Definition at line 567 of file def.h.

◆ DefDefSet

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

Definition at line 568 of file def.h.

◆ DefMap

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

Definition at line 50 of file def.h.

◆ Defs

using thorin::Defs = typedef Span<const Def*>

Definition at line 53 of file def.h.

◆ DefSet

using thorin::DefSet = typedef GIDSet<const Def*>

Definition at line 51 of file def.h.

◆ DefVec

using thorin::DefVec = typedef std::vector<const Def*>

Definition at line 552 of file def.h.

◆ DomFrontiers

using thorin::DomFrontiers = typedef DomFrontierBase<true>

Definition at line 43 of file domfrontier.h.

◆ DomTree

typedef DomTreeBase< true > thorin::DomTree

Definition at line 47 of file domtree.h.

◆ f16

using thorin::f16 = typedef half

Definition at line 39 of file types.h.

◆ f32

using thorin::f32 = typedef float

Definition at line 40 of file types.h.

◆ f64

using thorin::f64 = typedef double

Definition at line 41 of file types.h.

◆ F_CFG

using thorin::F_CFG = typedef CFG<true>

Definition at line 15 of file scope.h.

◆ flags_t

using thorin::flags_t = typedef u64

Definition at line 45 of file types.h.

◆ GIDMap

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

Definition at line 192 of file util.h.

◆ GIDNodeMap

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

Definition at line 194 of file util.h.

◆ GIDNodeSet

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

Definition at line 195 of file util.h.

◆ GIDSet

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

Definition at line 193 of file util.h.

◆ hash_t

using thorin::hash_t = typedef uint32_t

Definition at line 9 of file hash.h.

◆ Join

using thorin::Join = typedef TBound<true>

Definition at line 147 of file lattice.h.

◆ Lam2Lam

using thorin::Lam2Lam = typedef LamMap<Lam*>

Definition at line 185 of file lam.h.

◆ LamMap

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

Definition at line 183 of file lam.h.

◆ LamSet

using thorin::LamSet = typedef GIDSet<Lam*>

Definition at line 184 of file lam.h.

◆ level_t

using thorin::level_t = typedef u64

Definition at line 42 of file types.h.

◆ Meet

using thorin::Meet = typedef TBound<false>

Definition at line 146 of file lattice.h.

◆ Mut2Mut

using thorin::Mut2Mut = typedef MutMap<Def*>

Definition at line 62 of file def.h.

◆ MutMap

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

Definition at line 60 of file def.h.

◆ MutSet

using thorin::MutSet = typedef GIDSet<Def*>

Definition at line 61 of file def.h.

◆ nat_t

using thorin::nat_t = typedef u64

Definition at line 43 of file types.h.

◆ node_t

using thorin::node_t = typedef u8

Definition at line 44 of file types.h.

◆ NormalizeFn

using thorin::NormalizeFn = typedef Ref (*)(Ref, Ref, Ref)

Definition at line 92 of file def.h.

◆ Normalizers

using thorin::Normalizers = typedef absl::flat_hash_map<flags_t, NormalizeFn>

Definition at line 19 of file plugin.h.

◆ Passes

using thorin::Passes = typedef 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 thorin::plugin_t = typedef u64

Definition at line 46 of file types.h.

◆ PostDomTree

using thorin::PostDomTree = typedef DomTreeBase<false>

Definition at line 48 of file domtree.h.

◆ s16

using thorin::s16 = typedef int16_t

Definition at line 35 of file types.h.

◆ s32

using thorin::s32 = typedef int32_t

Definition at line 35 of file types.h.

◆ s64

using thorin::s64 = typedef int64_t

Definition at line 35 of file types.h.

◆ s8

using thorin::s8 = typedef int8_t

Definition at line 35 of file types.h.

◆ sub_t

using thorin::sub_t = typedef u8

Definition at line 48 of file types.h.

◆ SymMap

template<class V >
using thorin::SymMap = typedef absl::flat_hash_map<Sym, V>

Definition at line 113 of file sym.h.

◆ Syms

using thorin::Syms = typedef std::deque<Sym>

Definition at line 115 of file sym.h.

◆ SymSet

using thorin::SymSet = typedef absl::flat_hash_set<Sym>

Definition at line 114 of file sym.h.

◆ tag_t

using thorin::tag_t = typedef u8

Definition at line 47 of file types.h.

◆ Top

using thorin::Top = typedef TExt<true>

Definition at line 145 of file lattice.h.

◆ u1

using thorin::u1 = typedef bool

Definition at line 38 of file types.h.

◆ u16

using thorin::u16 = typedef uint16_t

Definition at line 35 of file types.h.

◆ u32

using thorin::u32 = typedef uint32_t

Definition at line 35 of file types.h.

◆ u64

using thorin::u64 = typedef uint64_t

Definition at line 35 of file types.h.

◆ u8

using thorin::u8 = typedef uint8_t

Definition at line 35 of file types.h.

◆ undo_t

using thorin::undo_t = typedef size_t

Definition at line 14 of file pass.h.

◆ Uses

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

Definition at line 126 of file def.h.

◆ Var2Var

using thorin::Var2Var = typedef VarMap<const Var*>

Definition at line 70 of file def.h.

◆ VarMap

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

Definition at line 68 of file def.h.

◆ VarSet

using thorin::VarSet = typedef GIDSet<const Var*>

Definition at line 69 of file def.h.

◆ w2f

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

Definition at line 72 of file types.h.

◆ w2s

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

Definition at line 71 of file types.h.

◆ w2u

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

Definition at line 70 of file types.h.

Enumeration Type Documentation

◆ Dep

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

Definition at line 135 of file def.h.

◆ Sort

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

Definition at line 129 of file def.h.

Function Documentation

◆ assert_emplace()

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

◆ binary_find()

template<class I , class T , class Cmp >
I thorin::binary_find ( begin,
end,
val,
Cmp  cmp 
)

Definition at line 62 of file util.h.

Referenced by thorin::Bound::find().

◆ bitcast()

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

◆ bootstrap()

void thorin::bootstrap ( Driver driver,
Sym  plugin,
std::ostream &  h 
)

◆ breakpoint()

void thorin::breakpoint ( )
inline

Definition at line 27 of file assert.h.

Referenced by thorin::Log::log().

◆ collect_args()

std::pair< const Def *, std::vector< const Def * > > thorin::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 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().

◆ compose_cn()

const Def * thorin::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 thorin::Pi::dom(), H, thorin::Pi::isa_returning(), and thorin::Pi::ret_dom().

Referenced by thorin::autodiff::AutoDiffEval::augment_app().

◆ concat() [1/3]

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

◆ concat() [2/3]

template<class T >
auto thorin::concat ( const T &  val,
Span< T >  a 
) -> Array<T>

Definition at line 395 of file array.h.

References thorin::Array< T >::begin(), and thorin::Array< T >::front().

◆ concat() [3/3]

template<class T >
auto thorin::concat ( Span< T >  a,
const T &  val 
) -> Array<T>

Definition at line 403 of file array.h.

References thorin::Array< T >::back(), and thorin::Array< T >::begin().

◆ decurry()

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

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

◆ errf()

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

Definition at line 177 of file print.h.

References fmt(), and print().

Referenced by errln().

◆ errln()

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

Definition at line 179 of file print.h.

References errf(), and fmt().

◆ error() [1/3]

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

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

Definition at line 151 of file print.h.

References fmt(), and print().

◆ error() [2/3]

◆ error() [3/3]

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

Definition at line 67 of file loc.h.

References fmt(), and print().

◆ find() [1/2]

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

Definition at line 76 of file indexmap.h.

References find().

◆ find() [2/2]

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

◆ find_and_replace()

void thorin::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 74 of file util.h.

Referenced by thorin::autodiff::AutoDiffEval::augment_().

◆ flatten() [1/2]

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

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

◆ flatten() [2/2]

size_t thorin::flatten ( DefVec ops,
const Def def,
bool  flatten_muts 
)

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

◆ fmt()

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

◆ force() [1/2]

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

Definition at line 131 of file axiom.h.

◆ force() [2/2]

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

Definition at line 130 of file axiom.h.

◆ get_sign()

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

Definition at line 43 of file util.h.

◆ hash() [1/2]

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

hash_t thorin::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 thorin::hash_begin ( )
inline

Definition at line 111 of file hash.h.

References thorin::FNV1::offset.

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

◆ hash_begin() [2/2]

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

Definition at line 108 of file hash.h.

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

◆ hash_combine() [1/3]

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

Definition at line 98 of file hash.h.

References hash_combine().

◆ hash_combine() [2/3]

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

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

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

Definition at line 103 of file hash.h.

References hash_combine().

◆ is_associative() [1/2]

constexpr bool thorin::is_associative ( core::bit2  id)
constexpr

◆ is_associative() [2/2]

template<class Id >
constexpr bool thorin::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 139 of file axiom.h.

References is_commutative().

◆ is_commutative() [1/9]

constexpr bool thorin::is_commutative ( core::bit2  id)
constexpr

Definition at line 106 of file core.h.

◆ is_commutative() [2/9]

constexpr bool thorin::is_commutative ( core::icmp  id)
constexpr

Definition at line 103 of file core.h.

References thorin::core::ne.

◆ is_commutative() [3/9]

constexpr bool thorin::is_commutative ( core::nat  id)
constexpr

Definition at line 100 of file core.h.

Referenced by is_associative().

◆ is_commutative() [4/9]

constexpr bool thorin::is_commutative ( core::ncmp  id)
constexpr

Definition at line 101 of file core.h.

◆ is_commutative() [5/9]

constexpr bool thorin::is_commutative ( core::wrap  id)
constexpr

Definition at line 102 of file core.h.

References thorin::core::add, and thorin::core::mul.

◆ is_commutative() [6/9]

template<class Id >
constexpr bool thorin::is_commutative ( Id  )
constexpr

Definition at line 136 of file axiom.h.

◆ is_commutative() [7/9]

constexpr bool thorin::is_commutative ( math::arith  id)
constexpr

Definition at line 129 of file math.h.

References thorin::math::mul.

◆ is_commutative() [8/9]

constexpr bool thorin::is_commutative ( math::cmp  id)
constexpr

Definition at line 130 of file math.h.

◆ is_commutative() [9/9]

constexpr bool thorin::is_commutative ( math::extrema  )
constexpr

Definition at line 128 of file math.h.

◆ is_unit()

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

◆ isa_apped_mut_lam()

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

Definition at line 233 of file lam.h.

References thorin::RuntimeCast< B >::isa().

◆ isa_callee()

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

Definition at line 225 of file lam.h.

References thorin::RuntimeCast< B >::isa().

◆ isa_workable()

Lam * thorin::isa_workable ( Lam lam)
inline

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

◆ lazy_init()

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

◆ lookup()

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

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

◆ make_array()

template<class T >
Array< typename T::value_type > thorin::make_array ( const T &  container)

Definition at line 411 of file array.h.

◆ match() [1/2]

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

Definition at line 119 of file axiom.h.

References thorin::RuntimeCast< B >::as(), and thorin::Axiom::get().

◆ match() [2/2]

◆ merge() [1/2]

DefArray thorin::merge ( const Def def,
Defs  defs 
)

Definition at line 83 of file tuple.cpp.

References thorin::Span< T >::size().

Referenced by merge_sigma(), and merge_tuple().

◆ merge() [2/2]

DefArray thorin::merge ( Defs  a,
Defs  b 
)

Definition at line 87 of file tuple.cpp.

References thorin::Array< T >::begin(), and thorin::Span< T >::size().

◆ merge_sigma()

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

◆ merge_tuple()

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

◆ murmur3() [1/3]

hash_t thorin::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 thorin::murmur3 ( hash_t  h,
uint32_t  key 
)
inline

◆ murmur3() [3/3]

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

Definition at line 29 of file hash.h.

References murmur_32_scramble().

◆ murmur3_finalize()

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

Definition at line 51 of file hash.h.

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

◆ murmur3_rest() [1/2]

hash_t thorin::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 thorin::murmur3_rest ( hash_t  h,
uint8_t  key 
)
inline

Definition at line 41 of file hash.h.

References murmur_32_scramble().

Referenced by thorin::Def::Def().

◆ murmur_32_scramble()

hash_t thorin::murmur_32_scramble ( hash_t  k)
inline

Definition at line 15 of file hash.h.

Referenced by murmur3(), and murmur3_rest().

◆ operator""_f16()

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

Definition at line 85 of file types.h.

◆ operator""_f32()

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

Definition at line 86 of file types.h.

◆ operator""_f64()

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

Definition at line 87 of file types.h.

◆ operator""_n()

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

Definition at line 84 of file types.h.

◆ operator""_s()

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

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

Definition at line 83 of file types.h.

◆ operator""_s16()

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

Definition at line 80 of file types.h.

◆ operator""_s32()

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

Definition at line 80 of file types.h.

◆ operator""_s64()

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

Definition at line 80 of file types.h.

◆ operator""_s8()

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

Definition at line 80 of file types.h.

◆ operator""_u16()

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

Definition at line 80 of file types.h.

◆ operator""_u32()

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

Definition at line 80 of file types.h.

◆ operator""_u64()

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

Definition at line 80 of file types.h.

◆ operator""_u8()

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

Definition at line 80 of file types.h.

◆ operator&() [1/3]

constexpr auto thorin::operator& ( Dep  x,
Dep  y 
)
constexpr

Definition at line 144 of file def.h.

◆ operator&() [2/3]

constexpr auto thorin::operator& ( Dep  x,
std::underlying_type_t< Dep y 
)
constexpr

Definition at line 144 of file def.h.

◆ operator&() [3/3]

constexpr auto thorin::operator& ( std::underlying_type_t< Dep x,
Dep  y 
)
constexpr

Definition at line 144 of file def.h.

◆ operator<<() [1/7]

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

Definition at line 328 of file dump.cpp.

◆ operator<<() [2/7]

std::ostream & thorin::operator<< ( std::ostream &  o,
const Sym  sym 
)
inline

Definition at line 81 of file sym.h.

◆ operator<<() [3/7]

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

Definition at line 25 of file cfg.cpp.

References thorin::CFNode::mut().

◆ operator<<() [4/7]

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

◆ operator<<() [5/7]

std::ostream & thorin::operator<< ( std::ostream &  os,
const Loc  loc 
)

◆ operator<<() [6/7]

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.

◆ operator<<() [7/7]

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

◆ operator<=>() [1/2]

constexpr std::strong_ordering thorin::operator<=> ( Dep  x,
std::underlying_type_t< Dep y 
)
constexpr

Definition at line 144 of file def.h.

◆ operator<=>() [2/2]

constexpr std::strong_ordering thorin::operator<=> ( std::underlying_type_t< Dep x,
Dep  y 
)
constexpr

Definition at line 144 of file def.h.

◆ operator==() [1/2]

constexpr bool thorin::operator== ( Dep  x,
std::underlying_type_t< Dep y 
)
constexpr

Definition at line 144 of file def.h.

◆ operator==() [2/2]

constexpr bool thorin::operator== ( std::underlying_type_t< Dep x,
Dep  y 
)
constexpr

Definition at line 144 of file def.h.

◆ operator^() [1/3]

constexpr auto thorin::operator^ ( Dep  x,
Dep  y 
)
constexpr

Definition at line 144 of file def.h.

◆ operator^() [2/3]

constexpr auto thorin::operator^ ( Dep  x,
std::underlying_type_t< Dep y 
)
constexpr

Definition at line 144 of file def.h.

◆ operator^() [3/3]

constexpr auto thorin::operator^ ( std::underlying_type_t< Dep x,
Dep  y 
)
constexpr

Definition at line 144 of file def.h.

◆ operator|() [1/3]

constexpr auto thorin::operator| ( Dep  x,
Dep  y 
)
constexpr

Definition at line 144 of file def.h.

◆ operator|() [2/3]

constexpr auto thorin::operator| ( Dep  x,
std::underlying_type_t< Dep y 
)
constexpr

Definition at line 144 of file def.h.

◆ operator|() [3/3]

constexpr auto thorin::operator| ( std::underlying_type_t< Dep x,
Dep  y 
)
constexpr

Definition at line 144 of file def.h.

◆ optimize()

◆ outf()

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

Definition at line 176 of file print.h.

References fmt(), and print().

Referenced by outln().

◆ outln()

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

Definition at line 178 of file print.h.

References fmt(), and outf().

◆ pad()

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

Definition at line 52 of file util.h.

Referenced by thorin::core::normalize_trait().

◆ pop() [1/2]

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

Definition at line 90 of file util.h.

◆ pop() [2/2]

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

◆ print() [1/2]

◆ print() [2/2]

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

◆ register_pass()

template<class A , class P , class... CArgs>
void thorin::register_pass ( Passes passes,
CArgs &&...  args 
)

Definition at line 51 of file pipelinebuilder.h.

References thorin::PipelineBuilder::add_pass(), and assert_emplace().

◆ register_pass_with_arg()

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

◆ register_phase()

template<class A , class P , class... CArgs>
void thorin::register_phase ( Passes passes,
CArgs &&...  args 
)

Definition at line 59 of file pipelinebuilder.h.

References thorin::PipelineBuilder::add_phase(), and assert_emplace().

◆ rem() [1/4]

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

Definition at line 94 of file types.h.

◆ rem() [2/4]

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

Definition at line 93 of file types.h.

◆ rem() [3/4]

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

Definition at line 92 of file types.h.

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

◆ rem() [4/4]

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

Definition at line 95 of file types.h.

◆ rewrite() [1/5]

DefArray thorin::rewrite ( Def mut,
Ref  arg 
)

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

◆ rewrite() [2/5]

DefArray thorin::rewrite ( Def mut,
Ref  arg,
const Scope scope 
)

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

◆ rewrite() [3/5]

Ref thorin::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.

Definition at line 54 of file rewrite.cpp.

References rewrite().

◆ rewrite() [4/5]

Ref thorin::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.

Definition at line 52 of file rewrite.cpp.

References thorin::Def::op(), rewrite(), and thorin::Def::var().

◆ rewrite() [5/5]

Ref thorin::rewrite ( Ref  def,
Ref  old_def,
Ref  new_def,
const Scope scope 
)

◆ subview()

std::string_view thorin::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 68 of file util.h.

Referenced by thorin::Annex::split().

◆ thorin_get_plugin()

THORIN_EXPORT thorin::Plugin thorin::thorin_get_plugin ( )

To be implemented and exported by a plugin.

Returns
a filled Plugin.

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

◆ tuple2str()

std::string thorin::tuple2str ( const Def def)

◆ tuple_of_types()

Ref thorin::tuple_of_types ( Ref  t)

Definition at line 110 of file tuple.cpp.

Referenced by thorin::mem::op_lea().

◆ unflatten() [1/2]

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

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

◆ unflatten() [2/2]

const Def * thorin::unflatten ( Defs  defs,
const Def type,
bool  flatten_muts 
)

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

◆ unreachable()

◆ visit()

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

◆ visit_first()

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

Variable Documentation

◆ No_Undo

constexpr undo_t thorin::No_Undo = std::numeric_limits<undo_t>::max()
staticconstexpr