Thorin 1.9.0
The Higher ORder INtermediate representation
|
Base class for all Defs. More...
#include <thorin/def.h>
Public Member Functions | |
Getters | |
World & | world () const |
flags_t | flags () const |
u32 | gid () const |
hash_t | hash () const |
node_t | node () const |
std::string_view | node_name () const |
type | |
const Def * | type () const |
Yields the raw type of this Def, i.e. maybe nullptr . More... | |
const Def * | unfold_type () const |
Yields the type of this Def and builds a new .Type (UInc n) if necessary. More... | |
bool | is_term () const |
Yields true if this:T and T:(.Type 0) . More... | |
arity | |
Ref | arity () const |
std::optional< nat_t > | isa_lit_arity () const |
nat_t | as_lit_arity () const |
ops | |
template<size_t N = -1_s> | |
auto | ops () const |
const Def * | op (size_t i) const |
size_t | num_ops () const |
Setting Ops (Mutables Only) | |
You can set and change the Def::ops of a mutable after construction. However, you have to obey the following rules:
Thorin assumes that a mutable is final, when its last operand is set. Then, Def::check() will be invoked. | |
Def * | set (size_t i, const Def *def) |
Successively set from left to right. More... | |
Def * | reset (size_t i, const Def *def) |
Successively reset from left to right. More... | |
Def * | set (Defs ops) |
Def::set ops all at once. More... | |
Def * | reset (Defs ops) |
Def::reset ops all at once. More... | |
Def * | unset () |
Unsets all Def::ops; works even, if not set at all or partially. More... | |
Def * | set_type (const Def *) |
void | unset_type () |
void | update () |
Resolves Infers of this Def's type. More... | |
bool | is_set () const |
Yields true if empty or the last op is set. More... | |
extended_ops | |
Includes Def::type() (if not Def::ops() is only included, if Def::is_set. | |
Defs | extended_ops () const |
const Def * | extended_op (size_t i) const |
size_t | num_extended_ops () const |
partial_ops | |
Includes Def::type() and then the other Def::ops() in this order. Also works with partially set Defs and doesn't assert. Unset operands are | |
Defs | partial_ops () const |
const Def * | partial_op (size_t i) const |
size_t | num_partial_ops () const |
uses | |
const Uses & | uses () const |
size_t | num_uses () const |
dep | |
| |
unsigned | dep () const |
bool | has_dep (Dep d) const |
bool | has_dep (unsigned u) const |
bool | dep_const () const |
proj | |
Splits this Def via Extracts or directly accessing the Def::ops in the case of Sigmas or Arrays. std::array<const Def*, 2> ab = def->projs<2>();
auto [a, b] = def->projs<2>();
Array<const Def*> projs1 = def->projs(); // "projs1" has def->num_projs() many elements
Array<const Def*> projs2 = def->projs(n);// "projs2" has n elements - asserts if incorrect
// same as above but applies Lit::as<nat_t>(def) to each element
| |
nat_t | num_projs () const |
Yields Def::as_lit_arity(), if it is in fact a Lit, or 1 otherwise. More... | |
nat_t | num_tprojs () const |
As above but yields 1, if Flags::scalerize_threshold is exceeded. More... | |
const Def * | proj (nat_t a, nat_t i) const |
Similar to World::extract while assuming an arity of a , but also works on Sigmas and Arrays. More... | |
const Def * | proj (nat_t i) const |
As above but takes Def::num_projs as arity. More... | |
const Def * | tproj (nat_t i) const |
As above but takes Def::num_tprojs. More... | |
template<nat_t A = -1_n, class F > | |
auto | projs (F f) const |
Splits this Def via Def::projections into an Array (if A == -1_n ) or std::array (otherwise). More... | |
template<class F > | |
auto | tprojs (F f) const |
template<class F > | |
auto | projs (nat_t a, F f) const |
template<nat_t A = -1_n> | |
auto | projs () const |
auto | tprojs () const |
auto | projs (nat_t a) const |
var | |
Ref | var () |
nat_t | num_vars () |
nat_t | num_tvars () |
Ref | var (nat_t a, nat_t i) |
Ref | var (nat_t i) |
Ref | tvar (nat_t i) |
template<nat_t A = -1_s, class F > | |
auto | vars (F f) |
template<class F > | |
auto | tvars (F f) |
template<nat_t A = -1_s> | |
auto | vars () |
auto | tvars () |
template<class F > | |
auto | vars (nat_t a, F f) |
auto | vars (nat_t a) |
external | |
bool | is_external () const |
void | make_external () |
void | make_internal () |
void | transfer_external (Def *to) |
Casts | |
| |
template<class T = Def> | |
const T * | isa_imm () const |
template<class T = Def> | |
const T * | as_imm () const |
template<class T = Def, class R > | |
const T * | isa_imm (R(T::*f)() const) const |
template<class T = Def, bool invert = false> | |
T * | isa_mut () const |
If this is *mut*able, it will cast const ness away and perform a dynamic_cast to T . More... | |
template<class T = Def, bool invert = false> | |
T * | as_mut () const |
Asserts that this is a mutable, casts const ness away and performs a static_cast to T . More... | |
Dbg Getters | |
Dbg | dbg () const |
Loc | loc () const |
Sym | sym () const |
std::string | unique_name () const |
name + "_" + Def::gid More... | |
Dbg Setters | |
Every subclass | |
template<bool Ow = false> | |
const Def * | set (Loc l) const |
template<bool Ow = false> | |
Def * | set (Loc l) |
template<bool Ow = false> | |
const Def * | set (Sym s) const |
template<bool Ow = false> | |
Def * | set (Sym s) |
template<bool Ow = false> | |
const Def * | set (std::string s) const |
template<bool Ow = false> | |
Def * | set (std::string s) |
template<bool Ow = false> | |
const Def * | set (Loc l, Sym s) const |
template<bool Ow = false> | |
Def * | set (Loc l, Sym s) |
template<bool Ow = false> | |
const Def * | set (Loc l, std::string s) const |
template<bool Ow = false> | |
Def * | set (Loc l, std::string s) |
template<bool Ow = false> | |
const Def * | set (Dbg d) const |
template<bool Ow = false> | |
Def * | set (Dbg d) |
debug_prefix/suffix | |
Prepends/Appends a prefix/suffix to Def::name - but only in | |
const Def * | debug_prefix (std::string) const |
const Def * | debug_suffix (std::string) const |
Rebuild | |
virtual Def * | stub (World &, Ref) |
virtual Ref | rebuild (World &w, Ref type, Defs ops) const =0 |
Def::rebuilds this Def while using new_op as substitute for its i'th Def::op. More... | |
virtual const Def * | immutabilize () |
Tries to make an immutable from a mutable. More... | |
const Def * | refine (size_t i, const Def *new_op) const |
DefArray | reduce (const Def *arg) const |
Rewrites Def::ops by substituting this mutable's Var with arg . More... | |
DefArray | reduce (const Def *arg) |
Type Checking | |
virtual void | check () |
dump | |
void | dump () const |
void | dump (int max) const |
void | write (int max) const |
void | write (int max, const char *file) const |
std::ostream & | stream (std::ostream &, int max) const |
![]() | |
T * | as () |
static_cast with debug check. More... | |
const T * | as () const |
const version. More... | |
T * | isa () |
dynamic_cast . More... | |
Def * | isa () |
Yields B* if it is either T or U and `nullptr* otherwise. More... | |
const T * | isa () const |
const version. More... | |
const Def * | isa () const |
const version. More... | |
Protected Member Functions | |
Def (World *, node_t, const Def *type, Defs ops, flags_t flags) | |
Constructor for an immutable Def. More... | |
Def (node_t n, const Def *type, Defs ops, flags_t flags) | |
Def (node_t, const Def *type, size_t num_ops, flags_t flags) | |
Constructor for a mutable Def. More... | |
virtual | ~Def ()=default |
Wrappers for World::sym | |
These are here to have Def::setters inline without including | |
Sym | sym (const char *) const |
Sym | sym (std::string_view) const |
Sym | sym (std::string) const |
Protected Attributes | |
Dbg | dbg_ |
union { | |
NormalizeFn | normalizer_ |
Axioms use this member to store their normalizer. More... | |
const Axiom * | axiom_ |
World * | world_ |
Curried Apps of Axioms use this member to propagate the Axiom. More... | |
}; | |
flags_t | flags_ |
u8 | curry_ |
u8 | trip_ |
Base class for all Defs.
The data layout (see World::alloc and Def::partial_ops) looks like this:
Constructor for an immutable Def.
Definition at line 26 of file def.cpp.
References flags_, gid(), thorin::murmur3(), thorin::murmur3_finalize(), thorin::murmur3_rest(), thorin::World::next_gid(), node(), num_ops(), op(), ops(), type(), thorin::Node::Univ, and world().
Constructor for a mutable Def.
Definition at line 56 of file def.cpp.
References dep_const(), gid(), thorin::murmur3(), thorin::World::next_gid(), num_ops(), thorin::Use::Type, type(), and world().
|
protectedvirtualdefault |
Ref thorin::Def::arity | ( | ) | const |
Definition at line 307 of file def.cpp.
References thorin::World::lit_nat(), thorin::World::lit_nat_1(), type(), and world().
Referenced by thorin::autodiff::AutoDiffEval::augment_pack(), thorin::World::extract(), thorin::World::insert(), thorin::tuple2str(), and thorin::unflatten().
|
inline |
|
inline |
Definition at line 240 of file def.h.
References isa_lit_arity().
Referenced by thorin::World::extract(), thorin::regex::normalize_conj(), thorin::regex::normalize_disj(), and projs().
|
inline |
Asserts that this
is a mutable, casts const
ness away and performs a static_cast
to T
.
Definition at line 419 of file def.h.
Referenced by thorin::clos::clos_type(), thorin::autodiff::AutoDiffEval::derive_(), thorin::ll::Emitter::emit_epilogue(), thorin::Var::mut(), thorin::ll::Emitter::prepare(), thorin::dot::Emitter::prepare(), thorin::Cleanup::start(), and thorin::Emitter< Value, Type, BB, Child >::visit().
|
inlinevirtual |
Reimplemented in thorin::Pi, thorin::Lam, thorin::Sigma, and thorin::Arr.
Definition at line 474 of file def.h.
Referenced by set().
|
inline |
Definition at line 430 of file def.h.
References dbg_.
Referenced by thorin::Singleton::rebuild(), and thorin::Global::stub().
const Def * thorin::Def::debug_prefix | ( | std::string | prefix | ) | const |
Definition at line 261 of file def.cpp.
References dbg_, sym(), thorin::Dbg::sym, thorin::World::sym(), and world().
const Def * thorin::Def::debug_suffix | ( | std::string | suffix | ) | const |
Definition at line 266 of file def.cpp.
References dbg_, sym(), thorin::Dbg::sym, thorin::World::sym(), and world().
|
inline |
|
inline |
Definition at line 324 of file def.h.
References has_dep(), thorin::Mut, and thorin::Var.
Referenced by Def(), thorin::Scheduler::early(), thorin::Scheduler::late(), and thorin::Rewriter::rewrite_imm().
void thorin::Def::dump | ( | int | max | ) | const |
Definition at line 298 of file def.h.
References extended_ops().
Defs thorin::Def::extended_ops | ( | ) | const |
Definition at line 254 of file def.cpp.
References is_set(), and type().
Referenced by thorin::Scheduler::early(), extended_op(), num_extended_ops(), and thorin::PassMan::run().
|
inline |
Definition at line 218 of file def.h.
References flags_.
Referenced by thorin::Axiom::base(), thorin::Pi::is_implicit(), thorin::Global::is_mutable(), thorin::UInc::offset(), thorin::optimize(), thorin::Proxy::pass(), thorin::Axiom::plugin(), thorin::Axiom::sub(), thorin::Axiom::tag(), and thorin::Proxy::tag().
|
inline |
Definition at line 219 of file def.h.
Referenced by Def(), thorin::PipelineBuilder::def2pass(), thorin::refly::normalize_gid(), thorin::UseHash::operator()(), thorin::register_pass_with_arg(), and unique_name().
|
inline |
Definition at line 322 of file def.h.
References has_dep().
Referenced by dep_const(), has_dep(), and thorin::Infer::should_eliminate().
|
inline |
|
inlinevirtual |
Tries to make an immutable from a mutable.
This usually works if the mutable isn't recursive and its var isn't used.
Reimplemented in thorin::Pi, thorin::Sigma, thorin::Arr, and thorin::Pack.
|
inline |
Definition at line 395 of file def.h.
Referenced by thorin::isa_workable(), thorin::World::make_external(), and thorin::World::make_internal().
bool thorin::Def::is_set | ( | ) | const |
Yields true
if empty or the last op is set.
Definition at line 404 of file def.cpp.
References num_ops(), op(), and ops().
Referenced by thorin::World::app(), extended_ops(), thorin::isa_workable(), thorin::Rewriter::rewrite_mut(), thorin::PassMan::run(), thorin::Scheduler::Scheduler(), and thorin::Emitter< Value, Type, BB, Child >::visit().
bool thorin::Def::is_term | ( | ) | const |
Yields true
if this:T
and T:(.Type 0)
.
Definition at line 296 of file def.cpp.
References thorin::RuntimeCast< Def >::isa(), and type().
Referenced by thorin::flatten().
|
inline |
Definition at line 405 of file def.h.
Referenced by thorin::World::app(), thorin::merge_sigma(), thorin::merge_tuple(), thorin::core::normalize_trait(), and thorin::Infer::should_eliminate().
|
inline |
std::optional< nat_t > thorin::Def::isa_lit_arity | ( | ) | const |
Definition at line 314 of file def.cpp.
References thorin::RuntimeCast< Def >::isa(), and type().
Referenced by as_lit_arity(), thorin::flatten(), thorin::World::insert(), num_projs(), and num_tprojs().
|
inline |
If this
is *mut*able, it will cast const
ness away and perform a dynamic_cast
to T
.
Definition at line 411 of file def.h.
Referenced by thorin::World::app(), thorin::autodiff::AutoDiffEval::augment_(), thorin::Scheduler::early(), thorin::World::extract(), thorin::Infer::find(), thorin::Bound::find(), thorin::clos::isa_clos_type(), thorin::Scheduler::late(), reduce(), thorin::Rewriter::rewrite(), thorin::affine::LowerFor::rewrite(), thorin::Scalerize::rewrite(), thorin::clos::ClosConvPrep::rewrite_arg(), thorin::Scheduler::Scheduler(), thorin::World::tuple(), thorin::fe::TuplePtrn::type(), thorin::mem::AddMem::visit(), and thorin::Emitter< Value, Type, BB, Child >::visit().
|
inline |
Definition at line 431 of file def.h.
References dbg_, and thorin::Dbg::loc.
Referenced by thorin::error().
void thorin::Def::make_external | ( | ) |
Definition at line 412 of file def.cpp.
Referenced by transfer_external().
void thorin::Def::make_internal | ( | ) |
Definition at line 413 of file def.cpp.
References thorin::World::make_external(), and world().
Referenced by thorin::compile::InternalCleanup::enter(), thorin::optimize(), and transfer_external().
|
inline |
Definition at line 221 of file def.h.
Referenced by Def(), thorin::Pi::isa_cn(), and node_name().
std::string_view thorin::Def::node_name | ( | ) | const |
Definition at line 245 of file def.cpp.
References CODE, node(), THORIN_NODE, and thorin::unreachable().
Referenced by thorin::autodiff::AutoDiffEval::augment_(), thorin::autodiff::autodiff_type_fun(), thorin::dot::Emitter::emit_bb(), thorin::dot::Emitter::emit_imported(), and thorin::autodiff::zero_def().
|
inline |
Definition at line 299 of file def.h.
References extended_ops(), and thorin::Span< T >::size().
|
inline |
Definition at line 256 of file def.h.
Referenced by thorin::core::convert(), Def(), thorin::World::ext(), thorin::World::extract(), thorin::Scope::is_free(), is_set(), thorin::clos::isa_clos_type(), reset(), thorin::rewrite(), thorin::Rewriter::rewrite_imm(), thorin::Rewriter::rewrite_mut(), thorin::PassMan::run(), thorin::Scheduler::Scheduler(), set(), and unset().
|
inline |
Definition at line 309 of file def.h.
References partial_ops(), and thorin::Span< T >::size().
|
inline |
Yields Def::as_lit_arity(), if it is in fact a Lit, or 1
otherwise.
Definition at line 344 of file def.h.
References isa_lit_arity().
Referenced by thorin::clos::clos_insert_env(), thorin::clos::clos_remove_env(), thorin::mem::mem_def(), proj(), projs(), and thorin::mem::replace_mem().
nat_t thorin::Def::num_tprojs | ( | ) | const |
As above but yields 1, if Flags::scalerize_threshold is exceeded.
Definition at line 417 of file def.cpp.
References thorin::World::flags(), isa_lit_arity(), thorin::Flags::scalerize_threshold, and world().
|
inline |
Definition at line 390 of file def.h.
Referenced by thorin::ll::Emitter::emit_epilogue().
|
inline |
|
inline |
Definition at line 390 of file def.h.
Referenced by thorin::ll::Emitter::emit_epilogue(), and thorin::Lam::ret_var().
Definition at line 255 of file def.h.
References ops().
Referenced by thorin::App::arg(), thorin::Lam::body(), thorin::Arr::body(), thorin::Pack::body(), thorin::App::callee(), thorin::Test::clash(), thorin::clos::clos_type_to_pi(), thorin::Pi::codom(), Def(), thorin::Pi::dom(), thorin::World::extract(), thorin::Lam::filter(), thorin::Infer::find(), thorin::Bound::get(), thorin::Sigma::immutabilize(), thorin::Extract::index(), thorin::Insert::index(), thorin::Singleton::inhabitant(), thorin::Global::init(), is_set(), thorin::clos::isa_clos_type(), thorin::Type::level(), thorin::Test::match(), thorin::Var::mut(), thorin::mem::normalize_load(), thorin::Infer::op(), thorin::UInc::op(), thorin::Test::probe(), proj(), thorin::rewrite(), thorin::Rewriter::rewrite_mut(), thorin::PassMan::run(), thorin::Scheduler::Scheduler(), set(), thorin::Arr::shape(), thorin::Extract::tuple(), thorin::Insert::tuple(), unset(), thorin::Vel::value(), thorin::Pick::value(), thorin::Test::value(), and thorin::Insert::value().
|
inline |
Definition at line 249 of file def.h.
Referenced by thorin::World::arr(), thorin::CFA::CFA(), thorin::core::convert(), Def(), thorin::dot::Emitter::emit_bb(), thorin::World::extract(), thorin::Bound::find(), thorin::Sigma::immutabilize(), is_set(), thorin::core::normalize_trait(), op(), thorin::World::pack(), reduce(), refine(), reset(), thorin::Lam::set(), thorin::Sigma::set(), thorin::mem::strip_mem(), and thorin::mem::strip_mem_ty().
Definition at line 308 of file def.h.
References partial_ops().
|
inline |
Definition at line 307 of file def.h.
Referenced by num_partial_ops(), and partial_op().
Similar to World::extract while assuming an arity of a
, but also works on Sigmas and Arrays.
Definition at line 422 of file def.cpp.
References thorin::RuntimeCast< Def >::isa(), op(), thorin::Extract::tuple(), type(), uses(), and world().
Referenced by thorin::fe::TuplePtrn::bind(), thorin::clos::clos_remove_env(), thorin::ll::Emitter::emit_bb(), thorin::flatten(), thorin::World::insert(), projs(), thorin::clos::ClosConvPrep::rewrite_arg(), and tproj().
As above but takes Def::num_projs as arity.
Definition at line 350 of file def.h.
References num_projs(), and proj().
Referenced by proj().
|
inline |
|
inline |
Splits this Def via Def::projections into an Array (if A == -1_n
) or std::array
(otherwise).
Applies f
to each element.
Definition at line 355 of file def.h.
References as_lit_arity(), num_projs(), proj(), and projs().
Referenced by thorin::autodiff::AutoDiffEval::augment_tuple(), thorin::ll::Emitter::emit_bb(), thorin::clos::Clos2SJLJ::enter(), thorin::regex::flatten_in_arg(), thorin::mem::mem_def(), thorin::autodiff::normalize_add(), thorin::compile::normalize_combine_pass_list(), thorin::refly::normalize_dbg(), thorin::mem::normalize_lea(), thorin::mem::normalize_load(), thorin::regex::normalize_range(), thorin::matrix::normalize_read(), thorin::refly::normalize_refine(), thorin::matrix::normalize_shape(), thorin::mem::normalize_store(), thorin::autodiff::normalize_sum(), thorin::matrix::LowerMatrixMediumLevel::rewrite_(), thorin::matrix::LowerMatrixLowLevel::rewrite_imm(), thorin::mem::strip_mem(), thorin_get_plugin(), thorin::tuple2str(), and thorin::unflatten().
|
inline |
|
inline |
Def::rebuilds this Def while using new_op
as substitute for its i'th
Def::op.
Implemented in thorin::Axiom, thorin::Infer, thorin::Var, thorin::Univ, thorin::UMax, thorin::UInc, thorin::Type, thorin::Lit, thorin::Nat, thorin::Idx, thorin::Proxy, thorin::Global, thorin::Pi, thorin::Lam, thorin::App, thorin::TBound< Up >, thorin::Ac, thorin::Vel, thorin::Pick, thorin::Test, thorin::TExt< Up >, thorin::Singleton, thorin::Sigma, thorin::Tuple, thorin::Arr, thorin::Pack, thorin::Extract, and thorin::Insert.
Referenced by refine(), and thorin::Rewriter::rewrite_imm().
Definition at line 208 of file def.cpp.
References thorin::rewrite(), and world().
Rewrites Def::ops by substituting this
mutable's Var with arg
.
Definition at line 203 of file def.cpp.
References isa_mut(), and ops().
Referenced by thorin::World::app(), thorin::World::extract(), and thorin::compile::handle_optimization_part().
Definition at line 215 of file def.cpp.
References ops(), rebuild(), type(), and world().
Referenced by thorin::clos::clos_sub_env(), thorin::clos::ClosConvPrep::rewrite_arg(), and thorin::clos::ClosConvPrep::rewrite_callee().
Successively reset from left to right.
Definition at line 277 of file def.h.
References set(), and unset().
Referenced by thorin::RetWrap::enter(), thorin::Infer::find(), thorin::Infer::reset(), and thorin::PassMan::run().
Successively set from left to right.
Definition at line 352 of file def.cpp.
References assert_unused, check(), num_ops(), op(), and update().
Referenced by thorin::autodiff::AutoDiffEval::augment_extract(), thorin::autodiff::AutoDiffEval::augment_tuple(), thorin::fe::TuplePtrn::bind(), thorin::matrix::counting_for(), thorin::autodiff::AutoDiffEval::derive_(), thorin::direct::op_cps2ds_dep(), reset(), thorin::affine::LowerFor::rewrite(), thorin::clos::ClosConvPrep::rewrite_arg(), thorin::clos::ClosConvPrep::rewrite_callee(), thorin::Pack::set(), thorin::Global::set(), thorin::Infer::set(), thorin::Lam::set(), thorin::Sigma::set(), thorin::Lam::set_body(), thorin::Arr::set_body(), thorin::Pi::set_codom(), thorin::Pi::set_dom(), thorin::Lam::set_filter(), thorin::Arr::set_shape(), and thorin::fe::TuplePtrn::type().
|
inline |
|
inline |
Definition at line 391 of file def.cpp.
References thorin::Use::Type, type(), and unset_type().
Referenced by update().
std::ostream & thorin::Def::stream | ( | std::ostream & | os, |
int | max | ||
) | const |
Reimplemented in thorin::Infer, thorin::Global, thorin::Pi, thorin::Lam, thorin::TBound< Up >, thorin::TExt< Up >, thorin::Sigma, thorin::Arr, and thorin::Pack.
Definition at line 456 of file def.h.
References thorin::unreachable().
Referenced by thorin::Rewriter::rewrite_mut().
|
inline |
Definition at line 432 of file def.h.
References dbg_, and thorin::Dbg::sym.
Referenced by thorin::autodiff::AutoDiffEval::augment_lam(), debug_prefix(), debug_suffix(), thorin::compile::InternalCleanup::enter(), thorin::World::make_external(), thorin::World::make_internal(), thorin::Scope::sym(), thorin_get_plugin(), and unique_name().
|
protected |
Definition at line 225 of file def.cpp.
References thorin::World::sym(), and world().
|
protected |
Definition at line 227 of file def.cpp.
References thorin::World::sym(), and world().
|
protected |
Definition at line 226 of file def.cpp.
References thorin::World::sym(), and world().
As above but takes Def::num_tprojs.
Definition at line 351 of file def.h.
References num_tprojs(), and proj().
|
inline |
|
inline |
Definition at line 367 of file def.h.
References num_tprojs(), and projs().
|
inline |
Definition at line 398 of file def.h.
References make_external(), and make_internal().
|
inline |
Yields the raw type of this Def, i.e. maybe nullptr
.
Definition at line 229 of file def.h.
Referenced by thorin::Global::alloced_type(), thorin::World::app(), arity(), thorin::Check::assignable(), thorin::autodiff::AutoDiffEval::augment_(), thorin::autodiff::AutoDiffEval::augment_app(), thorin::autodiff::AutoDiffEval::augment_extract(), thorin::autodiff::AutoDiffEval::augment_pack(), thorin::autodiff::AutoDiffEval::augment_tuple(), thorin::App::callee_type(), thorin::Pi::check(), thorin::Arr::check(), thorin::clos::clos_pack(), thorin::matrix::counting_for(), Def(), thorin::autodiff::AutoDiffEval::derive_(), thorin::ll::Emitter::emit_bb(), thorin::clos::ClosLit::env_type(), thorin::clos::ClosConvPrep::eta_wrap(), extended_ops(), thorin::World::extract(), thorin::Bound::find(), thorin::flatten(), thorin::clos::ClosLit::fnc_type(), thorin::Bound::get(), thorin::compile::handle_optimization_part(), thorin::World::iapp(), thorin::World::iinfer(), thorin::World::insert(), is_term(), thorin::is_unit(), isa_lit_arity(), thorin::mem::mem_def(), thorin::merge_tuple(), thorin::core::normalize_bitcast(), thorin::core::op(), thorin::direct::op_cps2ds_dep(), thorin::mem::op_lea(), thorin::mem::op_lea_unsafe(), thorin::matrix::op_read(), thorin::optimize(), thorin::World::pack(), proj(), refine(), thorin::mem::replace_mem(), thorin::matrix::LowerMatrixHighLevelMapRed::rewrite_(), thorin::clos::ClosConvPrep::rewrite_callee(), thorin::Rewriter::rewrite_imm(), thorin::matrix::LowerMatrixLowLevel::rewrite_imm(), thorin::Rewriter::rewrite_mut(), thorin::PassMan::run(), thorin::Scheduler::Scheduler(), set_type(), thorin::Pack::shape(), thorin::mem::strip_mem(), thorin::World::test(), thorin::World::tuple(), thorin::clos::ClosLit::type(), thorin::Lam::type(), thorin::World::type(), thorin::World::uinc(), update(), and world().
const Def * thorin::Def::unfold_type | ( | ) | const |
Yields the type of this Def and builds a new .Type (UInc n)
if necessary.
Definition at line 235 of file def.cpp.
References thorin::World::type(), and world().
Referenced by thorin::World::arr(), thorin::Arr::check(), and thorin::Pi::infer().
std::string thorin::Def::unique_name | ( | ) | const |
name + "_" + Def::gid
Definition at line 415 of file def.cpp.
Referenced by thorin::dot::Emitter::emit_bb(), and thorin::dot::Emitter::emit_imported().
Def * thorin::Def::unset | ( | ) |
Unsets all Def::ops; works even, if not set at all or partially.
Definition at line 369 of file def.cpp.
References num_ops(), op(), and unset().
Referenced by reset(), thorin::Infer::unset(), unset(), thorin::Pi::unset(), thorin::Lam::unset(), thorin::Sigma::unset(), thorin::Arr::unset(), and thorin::Pack::unset().
void thorin::Def::unset_type | ( | ) |
|
inline |
Resolves Infers of this Def's type.
Definition at line 285 of file def.h.
References thorin::Ref::refer(), set_type(), and type().
Referenced by thorin::Infer::find(), and set().
|
inline |
Definition at line 314 of file def.h.
Referenced by num_uses(), proj(), and var().
Ref thorin::Def::var | ( | ) |
Definition at line 274 of file def.cpp.
References thorin::unreachable(), uses(), var(), and world().
Referenced by thorin::World::app(), thorin::autodiff::AutoDiffEval::augment_app(), thorin::autodiff::AutoDiffEval::augment_lam(), thorin::autodiff::AutoDiffEval::derive_(), thorin::ll::Emitter::emit_epilogue(), thorin::clos::ClosLit::env_var(), thorin::clos::ClosConvPrep::eta_wrap(), thorin::World::extract(), thorin::Scope::is_free(), thorin::clos::isa_clos_type(), thorin::mem::mem_var(), thorin::direct::op_cps2ds_dep(), thorin::Lam::ret_var(), thorin::rewrite(), and var().
|
inline |
Definition at line 390 of file def.h.
Referenced by thorin::RetWrap::enter(), and thorin::affine::LowerFor::rewrite().
|
inline |
World & thorin::Def::world | ( | ) | const |
Definition at line 229 of file def.cpp.
References type(), and world().
Referenced by thorin::Check::alpha(), thorin::Lam::app(), thorin::clos::apply_closure(), arity(), thorin::Check::assignable(), thorin::autodiff::AutoDiffEval::augment_(), thorin::autodiff::AutoDiffEval::augment_app(), thorin::autodiff::AutoDiffEval::augment_extract(), thorin::autodiff::AutoDiffEval::augment_lam(), thorin::autodiff::AutoDiffEval::augment_pack(), thorin::autodiff::AutoDiffEval::augment_tuple(), thorin::autodiff::autodiff_type_fun(), thorin::autodiff::autodiff_type_fun_pi(), thorin::Lam::branch(), thorin::Lam::check(), thorin::clos::clos_apply(), thorin::clos::clos_insert_env(), thorin::clos::clos_pack(), thorin::clos::clos_remove_env(), thorin::clos::clos_type(), thorin::clos::clos_type_to_pi(), thorin::mem::cn_mem(), thorin::mem::cn_mem_ret(), thorin::core::convert(), thorin::matrix::counting_for(), debug_prefix(), debug_suffix(), Def(), thorin::PipelineBuilder::def2pass(), thorin::autodiff::AutoDiffEval::derive_(), thorin::Infer::eliminate(), thorin::flatten(), thorin::mem::fn_mem(), thorin::autodiff::id_pullback(), thorin::Pi::immutabilize(), thorin::Sigma::immutabilize(), thorin::Arr::immutabilize(), thorin::Pack::immutabilize(), thorin::Pi::infer(), thorin::is_unit(), thorin::clos::isa_clos_type(), thorin::regex::make_binary_tree(), make_internal(), thorin::merge_sigma(), thorin::merge_tuple(), thorin::autodiff::normalize_ad(), thorin::autodiff::normalize_AD(), thorin::autodiff::normalize_add(), thorin::regex::normalize_any(), thorin::core::normalize_bitcast(), thorin::clos::normalize_clos(), thorin::compile::normalize_combine_pass_list(), thorin::compile::normalize_combined_phase(), thorin::regex::normalize_conj(), thorin::demo::normalize_const(), thorin::refly::normalize_dbg(), thorin::regex::normalize_disj(), thorin::refly::normalize_gid(), thorin::matrix::normalize_insert(), thorin::mem::normalize_lea(), thorin::mem::normalize_load(), thorin::matrix::normalize_map_reduce(), thorin::regex::normalize_not(), thorin::compile::normalize_pass_phase(), thorin::matrix::normalize_prod(), thorin::regex::normalize_quant(), thorin::regex::normalize_range(), thorin::matrix::normalize_read(), thorin::refly::normalize_refine(), thorin::mem::normalize_remem(), thorin::matrix::normalize_shape(), thorin::compile::normalize_single_pass_phase(), thorin::mem::normalize_store(), thorin::autodiff::normalize_sum(), thorin::core::normalize_trait(), thorin::matrix::normalize_transpose(), thorin::autodiff::normalize_zero(), num_tprojs(), thorin::core::op(), thorin::mem::op_alloc(), thorin::mem::op_lea(), thorin::mem::op_lea_unsafe(), thorin::mem::op_malloc(), thorin::mem::op_mslot(), thorin::matrix::op_read(), thorin::mem::op_remem(), thorin::mem::op_slot(), thorin::autodiff::op_sum(), thorin::operator<<(), thorin::mem::pi_mem(), proj(), thorin::autodiff::pullback_type(), reduce(), refine(), thorin::mem::replace_mem(), thorin::direct::DS2CPS::rewrite(), thorin::matrix::LowerMatrixMediumLevel::rewrite_(), thorin::PassMan::run(), thorin::Pi::set_dom(), thorin::Lam::set_filter(), thorin::Pack::shape(), stream(), thorin::mem::strip_mem(), thorin::mem::strip_mem_ty(), sym(), thorin::Lam::test(), unfold_type(), var(), world(), thorin::autodiff::zero_def(), and thorin::autodiff::zero_pullback().
void thorin::Def::write | ( | int | max | ) | const |
void thorin::Def::write | ( | int | max, |
const char * | file | ||
) | const |
union { ... } thorin::Def::@5 |
|
protected |
Definition at line 515 of file def.h.
Referenced by thorin::Axiom::curry(), and thorin::App::curry().
|
mutableprotected |
Definition at line 508 of file def.h.
Referenced by dbg(), debug_prefix(), debug_suffix(), loc(), and sym().
|
protected |
Definition at line 514 of file def.h.
Referenced by Def(), flags(), thorin::Lit::get(), thorin::Pi::make_explicit(), and thorin::Pi::make_implicit().
|
protected |
Definition at line 516 of file def.h.
Referenced by thorin::Axiom::trip(), and thorin::App::trip().