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

Namespaces

namespace  dl
 
namespace  ll
 
namespace  Node
 
namespace  plug
 
namespace  sys
 

Classes

class  Ac
 Constructs a Meet value. More...
 
struct  Annex
 Holds info about an entity defined within a Plugin (called Annex). More...
 
class  App
 
class  Arr
 A (possibly paramterized) Array. More...
 
class  Axiom
 
class  BetaRed
 Optimistically performs β-reduction (aka inlining). More...
 
class  BitSet
 
class  Bound
 Common base for TBound. More...
 
class  CFA
 Control Flow Analysis. More...
 
class  CFG
 A Control-Flow Graph. More...
 
class  CFNode
 A Control-Flow Node. More...
 
class  Check
 
class  Cleanup
 Removes unreachable and dead code by rebuilding the whole World into a new one and swapping afterwards. More...
 
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  IdPtrn
 
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  Lexer
 
class  Lit
 
class  Log
 Facility to log what you are doing. More...
 
class  LoopTree
 Calculates a loop nesting forest rooted at LoopTree::root_. More...
 
class  LoopTreeBuilder
 
class  Match
 
class  Nat
 
class  Pack
 A (possibly paramterized) Tuple. More...
 
class  Parser
 Parses Thorin code into the provided World. More...
 
class  Pass
 All Passes that want to be registered in the PassMan must implement this interface. More...
 
class  PassMan
 An optimizer that combines several optimizations in an optimal way. More...
 
class  PassManPhase
 Wraps a PassMan pipeline as a Phase. More...
 
class  PassPhase
 Wraps a Pass as a Phase. More...
 
class  Phase
 As opposed to a Pass, a Phase does one thing at a time and does not mix with other Phases. More...
 
class  Pi
 A dependent function type. More...
 
class  Pick
 Picks the aspect of a Meet [value](Pick::value) by its [type](Def::type). More...
 
class  Pipeline
 Organizes several Phases as a pipeline. More...
 
class  PipelineBuilder
 
struct  Plugin
 Basic info and registration function pointer to be returned from a specific plugin. More...
 
class  Proxy
 
class  Ptrn
 
class  Ref
 Helper class to retrieve Infer::arg if present. More...
 
class  Res
 Utility class when folding constants in normalizers. More...
 
class  RetWrap
 
class  Rewriter
 Recurseivly rewrites part of a program into the provided World. More...
 
class  RWPass
 Inherit from this class 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  Scopes
 
class  Sigma
 A dependent tuple type. More...
 
class  Singleton
 A singleton wraps a type into a higher order type. More...
 
class  Span
 This is a thin wrapper for std::span<T, N> with the following additional features: More...
 
class  Tab
 Keeps track of indentation level. More...
 
class  TailRecElim
 
class  TBound
 Specific Bound depending on Up. More...
 
class  Test
 Test whether Test::value currently holds type Test::probe: More...
 
class  TExt
 Extremum. Either Top (Up) or Bottom. More...
 
class  Tok
 
class  Tuple
 Data constructor for a Sigma. More...
 
class  TuplePtrn
 
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  Vector
 This is a thin wrapper for absl::InlinedVector<T, N, A> which in turn is a drop-in replacement for std::vector<T, A>. More...
 
class  Vel
 Constructs a Join value. More...
 
class  World
 The World represents the whole program and manages creation of Thorin nodes (Defs). More...
 

Concepts

concept  annex_with_subs
 
concept  annex_without_subs
 
concept  Vectorlike
 Something which behaves like std::vector or std::array.
 

Typedefs

using Def2Fields = DefMap< Vector< Sym > >
 
using Ptrns = std::deque< std::unique_ptr< Ptrn > >
 
template<class T , size_t N = std::dynamic_extent>
using View = Span< const T, N >
 
using Tag = Tok::Tag
 
Control Flow
using CFNodes = GIDSet< const CFNode * >
 
using DomFrontiers = DomFrontierBase< true >
 
using ControlDeps = DomFrontierBase< false >
 
using DomTree = DomTreeBase< true >
 
using PostDomTree = DomTreeBase< false >
 
using F_CFG = CFG< true >
 
using B_CFG = CFG< false >
 
Def

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

template<class To >
using DefMap = GIDMap< const Def *, To >
 
using DefSet = GIDSet< const Def * >
 
using Def2Def = DefMap< const Def * >
 
using Defs = View< const Def * >
 
using DefVec = Vector< const Def * >
 
Def (Mutable)

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

template<class To >
using MutMap = GIDMap< Def *, To >
 
using MutSet = GIDSet< Def * >
 
using Mut2Mut = MutMap< Def * >
 
DefDef
using DefDef = std::tuple< const Def *, const Def * >
 
template<class To >
using DefDefMap = absl::flat_hash_map< DefDef, To, DefDefHash, DefDefEq >
 
using DefDefSet = absl::flat_hash_set< DefDef, DefDefHash, DefDefEq >
 
Lam

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

template<class To >
using LamMap = GIDMap< Lam *, To >
 
using LamSet = GIDSet< Lam * >
 
using Lam2Lam = LamMap< Lam * >
 
Lattice
using Bot = TExt< false >
 
using Top = TExt< true >
 
using Meet = TBound< false >
 
using Join = TBound< true >
 
Aliases for some Base Types
using hash_t = uint32_t
 
using s8 = int8_t
 
using u8 = uint8_t
 
using s16 = int16_t
 
using u16 = uint16_t
 
using s32 = int32_t
 
using u32 = uint32_t
 
using s64 = int64_t
 
using u64 = uint64_t
 
using u1 = bool
 
using f16 = half
 
using f32 = float
 
using f64 = double
 
using level_t = u64
 
using nat_t = u64
 
using node_t = u8
 
using flags_t = u64
 
using plugin_t = u64
 
using tag_t = u8
 
using sub_t = u8
 
Width to Signed/Unsigned/Float
template<int w>
using w2u = typename detail::w2u_< w >::type
 
template<int w>
using w2s = typename detail::w2s_< w >::type
 
template<int w>
using w2f = typename detail::w2f_< w >::type
 
GID
template<class K , class V >
using GIDMap = absl::flat_hash_map< K, V, GIDHash< K >, GIDEq< K > >
 
template<class K >
using GIDSet = absl::flat_hash_set< K, GIDHash< K >, GIDEq< K > >
 
template<class K , class V >
using GIDNodeMap = absl::node_hash_map< K, V, GIDHash< K >, GIDEq< K > >
 
template<class K >
using GIDNodeSet = absl::node_hash_set< K, GIDHash< K >, GIDEq< K > >
 

Enumerations

Dep
enum class  Dep : unsigned {
  None = 0 ,
  Axiom = 1 << 0 ,
  Infer = 1 << 1 ,
  Mut = 1 << 2 ,
  Proxy = 1 << 3 ,
  Var = 1 << 4
}
 

Functions

void bootstrap (Driver &, Sym, std::ostream &)
 
void commute (const Def *&a, const Def *&b)
 Swap Lit to left - or smaller Def::gid, if no lit present.
 
void optimize (World &)
 
template<class... T>
auto _any (T... args)
 
std::ostream operator
std::ostream & operator<< (std::ostream &, const CFNode *)
 
std::ostream & operator<< (std::ostream &os, const Def *def)
 This will stream def as an operand.
 
std::ostream & operator<< (std::ostream &, Ref)
 
template<bool forward>
std::ostream & operator<< (std::ostream &os, const typename LoopTree< forward >::Base *n)
 
std::ostream & operator<< (std::ostream &os, Tok tok)
 
match/force
template<class Id , bool DynCast = true>
auto match (Ref def)
 
template<class Id , bool DynCast = true>
auto match (Id id, Ref def)
 
template<class Id >
auto force (Ref def)
 
template<class Id >
auto force (Id id, Ref def)
 
is_commutative/is_associative
template<class Id >
constexpr bool is_commutative (Id)
 
template<class Id >
constexpr bool is_associative (Id id)
 
constexpr bool is_commutative (plug::core::nat id)
 
constexpr bool is_commutative (plug::core::ncmp id)
 
constexpr bool is_commutative (plug::core::wrap id)
 
constexpr bool is_commutative (plug::core::icmp id)
 
constexpr bool is_commutative (plug::core::bit2 id)
 
constexpr bool is_associative (plug::core::bit2 id)
 
constexpr bool is_associative (plug::core::nat id)
 
constexpr bool is_associative (plug::core::ncmp id)
 
constexpr bool is_associative (plug::core::icmp id)
 
constexpr bool is_associative (plug::core::wrap id)
 
constexpr bool is_commutative (plug::math::extrema)
 
constexpr bool is_commutative (plug::math::arith id)
 
constexpr bool is_commutative (plug::math::cmp id)
 
constexpr bool is_associative (plug::math::arith id)
 
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.
 
template<class T , class... Args>
std::ostream & print (std::ostream &os, const char *s, T &&t, Args &&... args)
 
template<class... Args>
std::ostream & println (std::ostream &os, const char *fmt, Args &&... args)
 As above but end with std::endl.
 
template<class... Args>
std::string fmt (const char *s, Args &&... args)
 Wraps thorin::print to output a formatted std:string.
 
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.
 
Helpers to work with Functions
const Appisa_callee (const Def *def, size_t i)
 
Lamisa_workable (Lam *lam)
 These are Lams that are neither nullptr, nor Lam::is_external, nor Lam::is_unset.
 
std::pair< const App *, Lam * > isa_apped_mut_lam (const Def *def)
 
std::deque< const App * > decurry (const Def *)
 Yields curried Apps in a flat std::deque<const App*>.
 
const Defcompose_cn (const Def *f, const Def *g)
 The high level view is:
 
std::pair< const Def *, std::vector< const Def * > > collect_args (const Def *def)
 Helper function to cope with the fact that normalizers take all arguments and not only its axiom arguments.
 
Register Pass/Phase
template<class A , class P , class... CArgs>
void register_pass (Passes &passes, CArgs &&... args)
 
template<class A , class P , class... CArgs>
void register_phase (Passes &passes, CArgs &&... args)
 
template<class A , class P , class Q >
void register_pass_with_arg (Passes &passes)
 
rewrite

Rewrites 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)
 Rewrites mut's i^th op by substituting mut's Var with arg while obeying mut's 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.
 
DefVec rewrite (Def *mut, Ref arg)
 Rewrites mut's ops by substituting mut's Var with arg while obeying mut's scope.
 
DefVec rewrite (Def *mut, Ref arg, const Scope &scope)
 Same as above but uses scope as an optimization instead of computing a new Scope.
 
Helpers to work with Tulpes/Sigmas/Arrays/Packs
bool is_unit (const Def *)
 
std::string tuple2str (const Def *)
 
const Defflatten (const Def *def)
 Flattens a sigma/array/pack/tuple.
 
size_t flatten (DefVec &ops, const Def *def, bool flatten_sigmas=true)
 Same as unflatten, but uses the operands of a flattened pack/tuple directly.
 
const Defunflatten (const Def *def, const Def *type)
 Applies the reverse transformation on a pack/tuple, given the original type.
 
const Defunflatten (Defs ops, const Def *type, bool flatten_muts=true)
 Same as unflatten, but uses the operands of a flattened pack/tuple directly.
 
DefVec merge (Defs, Defs)
 
DefVec merge (const Def *def, Defs defs)
 
const Defmerge_sigma (const Def *def, Defs defs)
 
const Defmerge_tuple (const Def *def, Defs defs)
 
Ref tuple_of_types (Ref t)
 
Murmur3 Hash

See Wikipedia.

hash_t murmur_32_scramble (hash_t k)
 
hash_t murmur3 (hash_t h, uint32_t key)
 
hash_t murmur3 (hash_t h, uint64_t key)
 
hash_t murmur3_rest (hash_t h, uint8_t key)
 
hash_t murmur3_rest (hash_t h, uint16_t key)
 
hash_t murmur3_finalize (hash_t h, hash_t len)
 
hash_t murmur3 (hash_t h)
 Use for a single value to hash.
 
FNV-1 Hash

See Wikipedia.

template<class T >
hash_t hash_combine (hash_t seed, T v)
 Returns a new hash by combining the hash seed with val.
 
template<class T >
hash_t hash_combine (hash_t seed, T *val)
 
template<class T , class... Args>
hash_t hash_combine (hash_t seed, T val, Args &&... args)
 
template<class T >
hash_t hash_begin (T val)
 
hash_t hash_begin ()
 
String Hashing
hash_t hash (const char *)
 
hash_t hash (std::string_view)
 
IndexMap find
template<class Indexer , class Key , class Value >
Value * find (IndexMap< Indexer, Key, Value * > &map, Key key)
 
template<class Indexer , class Key , class Value >
const Value * find (const IndexMap< Indexer, Key, Value * > &map, Key key)
 
IndexSet visit
template<class Indexer , class Key >
bool visit (IndexSet< Indexer, Key > &set, const Key &key)
 
template<class Indexer , class Key >
void visit_first (IndexSet< Indexer, Key > &set, const Key &key)
 
out/err

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)
 
Deduction Guides

{@

template<class I , class E >
 Span (I, E) -> Span< std::remove_reference_t< std::iter_reference_t< I > > >
 
template<class T , size_t N>
 Span (T(&)[N]) -> Span< T, N >
 
template<class T , size_t N>
 Span (std::array< T, N > &) -> Span< T, N >
 
template<class T , size_t N>
 Span (const std::array< T, N > &) -> Span< const T, N >
 
template<class R >
 Span (R &&) -> Span< std::remove_reference_t< std::ranges::range_reference_t< R > > >
 
template<Vectorlike Vec>
 Span (Vec &) -> Span< typename Vec::value_type, std::dynamic_extent >
 
template<Vectorlike Vec>
 Span (const Vec &) -> Span< const typename Vec::value_type, std::dynamic_extent >
 
template<class I , class A = std::allocator<typename std::iterator_traits<I>::value_type>>
 Vector (I, I, A=A()) -> Vector< typename std::iterator_traits< I >::value_type, Default_Inlined_Size< typename std::iterator_traits< I >::value_type >, A >
 
template<class R , class S >
bool equal (R range1, S range2)
 }@
 
template<class T , size_t N, class A , class U >
constexpr Vector< T, N, A >::size_type erase (Vector< T, N, A > &c, const U &value)
 
template<class T , size_t N, class A , class Pred >
constexpr Vector< T, N, A >::size_type erase_if (Vector< T, N, A > &c, Pred pred)
 
User-Defined Literals
constexpr s8 operator""_s8 (unsigned long long int s)
 
constexpr u8 operator""_u8 (unsigned long long int u)
 
constexpr s16 operator""_s16 (unsigned long long int s)
 
constexpr u16 operator""_u16 (unsigned long long int u)
 
constexpr s32 operator""_s32 (unsigned long long int s)
 
constexpr u32 operator""_u32 (unsigned long long int u)
 
constexpr s64 operator""_s64 (unsigned long long int s)
 
constexpr u64 operator""_u64 (unsigned long long int u)
 
constexpr size_t operator""_s (unsigned long long int i)
 A size_t literal. Use 0_s to disambiguate 0 from nullptr.
 
constexpr nat_t operator""_n (unsigned long long int i)
 
f16 operator""_f16 (long double d)
 
constexpr f32 operator""_f32 (long double d)
 
constexpr f64 operator""_f64 (long double d)
 
rem
half rem (half a, half b)
 
float rem (float a, float b)
 
double rem (double a, double b)
 
long double rem (long double a, long double b)
 
Utility Functions
template<class This , class T >
T & lazy_init (const This *self, std::unique_ptr< T > &ptr)
 
template<class D , class S >
bitcast (const S &src)
 A bitcast from src of type S to D.
 
template<class T >
bool get_sign (T val)
 
u64 pad (u64 offset, u64 align)
 
Algorithms
template<class I , class T , class Cmp >
binary_find (I begin, I end, T val, Cmp cmp)
 
std::string_view subview (std::string_view s, size_t i, size_t n=std::string_view::npos)
 Like std::string::substr, but works on std::string_view instead.
 
void find_and_replace (std::string &str, std::string_view what, std::string_view repl)
 Replaces all occurrences of what with repl.
 
Helpers for Containers
template<class S >
auto pop (S &s) -> decltype(s.top(), typename S::value_type())
 
template<class Q >
auto pop (Q &q) -> decltype(q.front(), typename Q::value_type())
 
template<class C , class K >
auto lookup (const C &container, const K &key)
 Yields pointer to element (or the element itself if it is already a pointer), if found and nullptr otherwise.
 
template<class C , class... Args>
auto assert_emplace (C &container, Args &&... args)
 Invokes emplace on container, asserts that insertion actually happened, and returns the iterator.
 

Variables

constexpr size_t Look_Ahead = 2
 
constexpr auto Num_Keys = size_t(0) + size_t(1) + size_t(1) + size_t(1) + size_t(1) + size_t(1) + size_t(1) + size_t(1) + size_t(1) + size_t(1) + size_t(1) + size_t(1) + size_t(1) + size_t(1) + size_t(1) + size_t(1) + size_t(1) + size_t(1) + size_t(1) + size_t(1) + size_t(1) + size_t(1) + size_t(1) + size_t(1) + size_t(1) + size_t(1)
 
template<class T >
static constexpr size_t Default_Inlined_Size = std::max((size_t)1, 4 * sizeof(size_t) / sizeof(T))
 

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 >
 

Undo

Used by FPPass::analyze to indicate where to backtrack to.

using undo_t = size_t
 
static constexpr undo_t No_Undo = std::numeric_limits<undo_t>::max()
 

Plugin Interface

See also
Plugin
using Normalizers = absl::flat_hash_map< flags_t, NormalizeFn >
 
using Passes = absl::flat_hash_map< flags_t, std::function< void(World &, PipelineBuilder &, const Def *)> >
 axiom ↦ (pipeline part) × (axiom application) → ()
The function should inspect Application to construct the Pass/Phase and add it to the pipeline.
 
using Backends = absl::btree_map< std::string, void(*)(World &, std::ostream &)>
 
THORIN_EXPORT thorin::Plugin thorin_get_plugin ()
 To be implemented and exported by a plugin.
 

Class Documentation

◆ thorin::Dbg

struct thorin::Dbg

Definition at line 31 of file dbg.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 15 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 142 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 43 of file domfrontier.h.

◆ Def2Def

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

Definition at line 60 of file def.h.

◆ Def2Fields

using thorin::Def2Fields = typedef DefMap<Vector<Sym> >

Definition at line 17 of file ast.h.

◆ DefDef

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

Definition at line 565 of file def.h.

◆ DefDefMap

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

Definition at line 580 of file def.h.

◆ DefDefSet

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

Definition at line 581 of file def.h.

◆ DefMap

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

Definition at line 58 of file def.h.

◆ Defs

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

Definition at line 61 of file def.h.

◆ DefSet

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

Definition at line 59 of file def.h.

◆ DefVec

using thorin::DefVec = typedef Vector<const Def*>

Definition at line 62 of file def.h.

◆ DomFrontiers

using thorin::DomFrontiers = typedef DomFrontierBase<true>

Definition at line 42 of file domfrontier.h.

◆ DomTree

typedef DomTreeBase< true > thorin::DomTree

Definition at line 46 of file domtree.h.

◆ f16

using thorin::f16 = typedef half

Definition at line 40 of file types.h.

◆ f32

using thorin::f32 = typedef float

Definition at line 41 of file types.h.

◆ f64

using thorin::f64 = typedef double

Definition at line 42 of file types.h.

◆ F_CFG

using thorin::F_CFG = typedef CFG<true>

Definition at line 14 of file scope.h.

◆ flags_t

using thorin::flags_t = typedef u64

Definition at line 46 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 179 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 181 of file util.h.

◆ GIDNodeSet

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

Definition at line 182 of file util.h.

◆ GIDSet

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

Definition at line 180 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 145 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 43 of file types.h.

◆ Meet

using thorin::Meet = typedef TBound<false>

Definition at line 144 of file lattice.h.

◆ Mut2Mut

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

Definition at line 70 of file def.h.

◆ MutMap

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

Definition at line 68 of file def.h.

◆ MutSet

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

Definition at line 69 of file def.h.

◆ nat_t

using thorin::nat_t = typedef u64

Definition at line 44 of file types.h.

◆ node_t

using thorin::node_t = typedef u8

Definition at line 45 of file types.h.

◆ NormalizeFn

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

Definition at line 100 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 47 of file types.h.

◆ PostDomTree

using thorin::PostDomTree = typedef DomTreeBase<false>

Definition at line 47 of file domtree.h.

◆ Ptrns

using thorin::Ptrns = typedef std::deque<std::unique_ptr<Ptrn> >

Definition at line 45 of file ast.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 49 of file types.h.

◆ Tag

Definition at line 10 of file lexer.cpp.

◆ tag_t

using thorin::tag_t = typedef u8

Definition at line 48 of file types.h.

◆ Top

using thorin::Top = typedef TExt<true>

Definition at line 143 of file lattice.h.

◆ u1

using thorin::u1 = typedef bool

Definition at line 39 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 134 of file def.h.

◆ Var2Var

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

Definition at line 78 of file def.h.

◆ VarMap

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

Definition at line 76 of file def.h.

◆ VarSet

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

Definition at line 77 of file def.h.

◆ View

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

Definition at line 88 of file span.h.

◆ w2f

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

Definition at line 75 of file types.h.

◆ w2s

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

Definition at line 74 of file types.h.

◆ w2u

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

Definition at line 73 of file types.h.

Enumeration Type Documentation

◆ Dep

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

Definition at line 143 of file def.h.

◆ Sort

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

Definition at line 137 of file def.h.

Function Documentation

◆ _any()

template<class... T>
auto thorin::_any ( T...  args)
inline

Definition at line 278 of file lexer.cpp.

◆ 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 102 of file util.h.

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::TuplePtrn::type().

◆ binary_find()

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

Definition at line 58 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 26 of file util.h.

Referenced by thorin::ll::Emitter::emit_bb().

◆ bootstrap()

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

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

Referenced by collect_args(), thorin::plug::compile::handle_optimization_part(), thorin::plug::compile::normalize_combine_pass_list(), thorin::plug::compile::normalize_combined_phase(), thorin::plug::compile::normalize_pass_phase(), optimize(), and thorin_get_plugin().

◆ commute()

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

Swap Lit to left - or smaller Def::gid, if no lit present.

Definition at line 25 of file normalize.h.

References thorin::Def::gid().

Referenced by thorin::plug::core::normalize_bit2(), thorin::plug::core::normalize_nat(), and thorin::plug::core::normalize_ncmp().

◆ 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(), thorin::Pi::isa_returning(), and thorin::Pi::ret_dom().

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

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

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

◆ equal()

template<class R , class S >
bool thorin::equal ( range1,
range2 
)

}@

Definition at line 57 of file vector.h.

Referenced by thorin::plug::mem::CopyProp::rewrite().

◆ erase()

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

Definition at line 66 of file vector.h.

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

◆ erase_if()

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

Definition at line 74 of file vector.h.

◆ 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 23 of file dbg.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 73 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 70 of file util.h.

Referenced by thorin::plug::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().

Referenced by flatten(), flatten(), and thorin::Scalerize::rewrite().

◆ flatten() [2/2]

size_t thorin::flatten ( DefVec ops,
const Def def,
bool  flatten_sigmas = true 
)

Same as unflatten, but uses the operands of a flattened pack/tuple directly.

Definition at line 56 of file tuple.cpp.

References flatten(), thorin::Def::isa_lit_arity(), and thorin::Def::proj().

◆ 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 144 of file print.h.

References print().

Referenced by thorin::ll::compile(), errf(), errln(), error(), error(), error(), thorin::Log::log(), thorin::Log::log(), outf(), outln(), and println().

◆ force() [1/2]

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

Definition at line 127 of file axiom.h.

◆ force() [2/2]

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

Definition at line 126 of file axiom.h.

◆ get_sign()

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

Definition at line 40 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 103 of file hash.h.

References thorin::FNV1::offset.

Referenced by hash(), and hash().

◆ hash_begin() [2/2]

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

Definition at line 102 of file hash.h.

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

Referenced by thorin::UseHash::operator()().

◆ hash_combine() [1/3]

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

Definition at line 96 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 83 of file hash.h.

References thorin::FNV1::prime.

Referenced by hash(), hash(), hash_begin(), hash_combine(), 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 98 of file hash.h.

References hash_combine().

◆ is_associative() [1/7]

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 135 of file axiom.h.

References is_commutative().

◆ is_associative() [2/7]

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

◆ is_associative() [3/7]

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

Definition at line 128 of file core.h.

References is_commutative().

◆ is_associative() [4/7]

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

Definition at line 126 of file core.h.

References is_commutative().

◆ is_associative() [5/7]

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

Definition at line 127 of file core.h.

References is_commutative().

◆ is_associative() [6/7]

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

Definition at line 129 of file core.h.

References is_commutative().

◆ is_associative() [7/7]

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

Definition at line 130 of file math.h.

References is_commutative().

◆ is_commutative() [1/9]

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

◆ is_commutative() [2/9]

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

Definition at line 106 of file core.h.

◆ is_commutative() [3/9]

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

Definition at line 103 of file core.h.

References thorin::plug::core::ne.

◆ is_commutative() [4/9]

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

Definition at line 100 of file core.h.

◆ is_commutative() [5/9]

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

Definition at line 101 of file core.h.

◆ is_commutative() [6/9]

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

Definition at line 102 of file core.h.

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

◆ is_commutative() [7/9]

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

Definition at line 128 of file math.h.

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

◆ is_commutative() [8/9]

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

Definition at line 129 of file math.h.

◆ is_commutative() [9/9]

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

Definition at line 127 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()

◆ isa_callee()

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

◆ isa_workable()

Lam * thorin::isa_workable ( Lam lam)
inline

◆ 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 93 of file util.h.

Referenced by thorin::Driver::backend(), thorin::World::external(), thorin::Driver::get_fun_ptr(), thorin::Driver::is_loaded(), thorin::EtaExp::new2old(), thorin::Driver::normalizer(), thorin::Driver::pass(), and thorin::EtaExp::rewrite().

◆ match() [1/2]

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

Definition at line 115 of file axiom.h.

References thorin::Axiom::get().

◆ match() [2/2]

◆ merge() [1/2]

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

Definition at line 83 of file tuple.cpp.

◆ merge() [2/2]

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

Definition at line 87 of file tuple.cpp.

Referenced by merge_sigma(), and merge_tuple().

◆ 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(), murmur3(), murmur3_rest(), and murmur3_rest().

◆ operator""_f16()

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

Definition at line 89 of file types.h.

◆ operator""_f32()

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

Definition at line 90 of file types.h.

◆ operator""_f64()

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

Definition at line 91 of file types.h.

◆ operator""_n()

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

Definition at line 88 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 87 of file types.h.

◆ operator""_s16()

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

Definition at line 83 of file types.h.

◆ operator""_s32()

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

Definition at line 83 of file types.h.

◆ operator""_s64()

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

Definition at line 83 of file types.h.

◆ operator""_s8()

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

Definition at line 83 of file types.h.

◆ operator""_u16()

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

Definition at line 83 of file types.h.

◆ operator""_u32()

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

Definition at line 83 of file types.h.

◆ operator""_u64()

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

Definition at line 83 of file types.h.

◆ operator""_u8()

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

Definition at line 83 of file types.h.

◆ operator<<() [1/5]

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

Definition at line 25 of file cfg.cpp.

References thorin::CFNode::mut().

◆ operator<<() [2/5]

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

Definition at line 329 of file dump.cpp.

◆ operator<<() [3/5]

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 333 of file dump.cpp.

References thorin::Def::world().

◆ operator<<() [4/5]

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

Definition at line 207 of file looptree.cpp.

References print().

◆ operator<<() [5/5]

std::ostream & thorin::operator<< ( std::ostream &  os,
Tok  tok 
)

Definition at line 24 of file tok.cpp.

◆ 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 49 of file util.h.

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

◆ pop() [1/2]

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

Definition at line 84 of file util.h.

◆ pop() [2/2]

template<class S >
auto 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 93 of file print.h.

References print().

◆ println()

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

As above but end with std::endl.

Definition at line 139 of file print.h.

References fmt(), and print().

◆ register_pass()

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

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

◆ rem() [1/4]

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

Definition at line 98 of file types.h.

◆ rem() [2/4]

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

Definition at line 97 of file types.h.

◆ rem() [3/4]

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

Definition at line 96 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 99 of file types.h.

◆ rewrite() [1/5]

DefVec 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 72 of file rewrite.cpp.

References rewrite().

◆ rewrite() [2/5]

DefVec 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 64 of file rewrite.cpp.

References thorin::Rewriter::map(), thorin::Def::num_ops(), thorin::Def::op(), thorin::ScopeRewriter::rewrite(), 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 59 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 57 of file rewrite.cpp.

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

◆ rewrite() [5/5]

◆ Span() [1/7]

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

◆ Span() [2/7]

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

◆ Span() [3/7]

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

◆ Span() [4/7]

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

◆ Span() [5/7]

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

◆ Span() [6/7]

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

◆ Span() [7/7]

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

◆ 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 64 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)

Definition at line 49 of file tuple.cpp.

References thorin::Def::arity(), thorin::Lit::as(), and thorin::Def::projs().

◆ tuple_of_types()

Ref thorin::tuple_of_types ( Ref  t)

Definition at line 110 of file tuple.cpp.

Referenced by thorin::plug::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::Lit::as(), thorin::Def::projs(), and unflatten().

Referenced by unflatten(), and unflatten().

◆ unflatten() [2/2]

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

Same as unflatten, but uses the operands of a flattened pack/tuple directly.

Definition at line 74 of file tuple.cpp.

References unflatten().

◆ Vector()

template<class I , class A = std::allocator<typename std::iterator_traits<I>::value_type>>
thorin::Vector ( ,
,
= A() 
) -> Vector< typename std::iterator_traits< I >::value_type, Default_Inlined_Size< typename std::iterator_traits< I >::value_type >, A >

◆ visit()

template<class Indexer , class Key >
bool thorin::visit ( IndexSet< Indexer, Key > &  set,
const Key &  key 
)

Definition at line 95 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 97 of file indexset.h.

References thorin::IndexSet< Indexer, Key >::contains(), and visit().

Variable Documentation

◆ Default_Inlined_Size

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

Definition at line 9 of file vector.h.

◆ Look_Ahead

constexpr size_t thorin::Look_Ahead = 2
constexpr

Definition at line 13 of file parser.h.

◆ No_Undo

◆ Num_Keys

constexpr auto thorin::Num_Keys = size_t(0) + size_t(1) + size_t(1) + size_t(1) + size_t(1) + size_t(1) + size_t(1) + size_t(1) + size_t(1) + size_t(1) + size_t(1) + size_t(1) + size_t(1) + size_t(1) + size_t(1) + size_t(1) + size_t(1) + size_t(1) + size_t(1) + size_t(1) + size_t(1) + size_t(1) + size_t(1) + size_t(1) + size_t(1) + size_t(1)
constexpr

Definition at line 42 of file tok.h.