18 static constexpr size_t Num_Ops = std::dynamic_extent;
27 Sigma(
const Def*
type,
size_t size)
35 Sigma*
set(
size_t i,
const Def* def) {
return Def::set(i, def)->as<Sigma>(); }
161class Extract :
public Def,
public Setters<Extract> {
186class Insert :
public Def,
public Setters<Insert> {
216 explicit operator bool() const noexcept {
return extract_; }
225 const Extract* extract_ =
nullptr;
234 explicit operator bool() const noexcept {
return app_; }
241 const App* app_ =
nullptr;
259 explicit operator bool() const noexcept {
return app_; }
273 const App* app_ =
nullptr;
274 const Extract* extract_ =
nullptr;
static constexpr auto Node
Arr * set(const Def *arity, const Def *body)
static constexpr size_t Num_Ops
Arr * set_body(const Def *body)
Arr * set_arity(const Def *arity)
const Def * callee() const
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.
constexpr Node node() const noexcept
Def * set(size_t i, const Def *)
Successively set from left to right.
World & world() const noexcept
constexpr auto ops() const noexcept
const Def * op(size_t i) const noexcept
const Def * type() const noexcept
Yields the "raw" type of this Def (maybe nullptr).
const Def * arity() const
Number of elements available to Extract / Insert (may be dynamic).
Def * unset()
Unsets all Def::ops; works even, if not set at all or only partially set.
constexpr auto reduce(const Def *arg) const
const Def * callee() const
const Def * index() const
size_t num_targets() const
const Def * target(size_t i) const
const Extract * extract() const
const Def * tuple() const
static constexpr auto Node
const Def * tuple() const
const Def * index() const
static constexpr size_t Num_Ops
const Def * value() const
static T as(const Def *def)
static constexpr size_t Num_Ops
static constexpr auto Node
Pack * set(const Def *body)
Base class for Sigma and Tuple.
static constexpr bool isa_node(mim::Node n) noexcept
Prod groups Sigma and Tuple; see fe::NodeSetable.
static constexpr size_t Num_Ops
Def(World *, Node, const Def *type, Defs ops, flags_t flags)
Constructor for an immutable Def.
const Extract * extract() const
Base class for Arr and Pack.
Seq * set(const Def *arity, const Def *body)
Common setter for Packs and Arrays.
static constexpr bool isa_node(mim::Node n) noexcept
Seq groups Arr and Pack; see fe::NodeSetable.
Def(World *, Node, const Def *type, Defs ops, flags_t flags)
Constructor for an immutable Def.
const Def * reduce(const Def *arg) const
CRTP-based mixin to declare setters for Def::loc & Def::name using a covariant return type.
const Tuple * set(Args &&... args) const
static const Def * infer(World &, Defs)
static constexpr auto Node
Sigma * set(size_t i, const Def *def)
static const Def * infer(World &, Defs)
static constexpr auto Node
The World represents the whole program and manages creation of MimIR nodes (Defs).
const Def * cat_tuple(nat_t n, nat_t m, const Def *a, const Def *b)
bool is_unit(const Def *)
fe::View< const Def * > Defs
std::string tuple2str(const Def *)
const Def * cat_sigma(nat_t n, nat_t m, const Def *a, const Def *b)
const Def * tuple_of_types(const Def *t)
fe::Vector< const Def * > DefVec