15 static constexpr size_t Num_Ops = std::dynamic_extent;
32 Sigma*
set(
size_t i,
const Def* def) {
return Def::set(i, def)->as<Sigma>(); }
143 const Def* immutabilize() final;
150 const Def* check(
size_t,
const Def*)
final;
151 const Def* check() final;
190 const Def* immutabilize() final;
206class Extract :
public Def,
public Setters<Extract> {
233class Insert :
public Def,
public Setters<Insert> {
236 : Def(
Node,
tuple->type(), {tuple, index, value}, 0) {}
265 explicit operator bool() const noexcept {
return extract_; }
274 const Extract* extract_ =
nullptr;
283 explicit operator bool() const noexcept {
return app_; }
286 const Def* callee()
const;
287 const Def* arg()
const;
290 const App* app_ =
nullptr;
308 explicit operator bool() const noexcept {
return app_; }
311 const Def* callee()
const;
312 const Def* arg()
const;
322 const App* app_ =
nullptr;
323 const Extract* extract_ =
nullptr;
328bool is_unit(
const Def*);
329std::string tuple2str(
const Def*);
332const Def* flatten(
const Def* def);
334size_t flatten(DefVec& ops,
const Def* def,
bool flatten_sigmas =
true);
337const Def* unflatten(
const Def* def,
const Def* type);
339const Def* unflatten(Defs ops,
const Def* type,
bool flatten_muts =
true);
341const Def* tuple_of_types(
const Def* t);
347DefVec cat(Defs, Defs);
351DefVec cat(nat_t n, nat_t m,
const Def* a,
const Def* b);
353const Def* cat_tuple(nat_t n, nat_t m,
const Def* a,
const Def* b);
354const Def* cat_sigma(nat_t n, nat_t m,
const Def* a,
const Def* b);
356const Def* cat_tuple(World&, Defs, Defs);
357const Def* cat_sigma(World&, Defs, Defs);
A (possibly paramterized) Array.
const Def * arity() const final
static constexpr auto Node
constexpr size_t reduction_offset() const noexcept final
First Def::op that needs to be dealt with during reduction; e.g.
Arr * set(const Def *arity, const Def *body)
static constexpr size_t Num_Ops
Arr * set_body(const Def *body)
const Def * reduce(const Def *arg) const final
Arr * set_arity(const Def *arity)
Arr * stub_(World &, const Def *) final
const Def * rebuild_(World &, const Def *, Defs) const final
Arr * stub(const Def *type)
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).
virtual const Def * arity() const
Def * unset()
Unsets all Def::ops; works even, if not set at all or only partially set.
constexpr auto reduce(const Def *arg) const
Def * stub(World &w, const Def *type)
const Def * index() const
size_t num_targets() const
const Def * target(size_t i) const
const Extract * extract() const
const Def * tuple() const
const Def * rebuild_(World &, const Def *, Defs) const final
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)
Pack * stub_(World &, const Def *) final
const Def * arity() const final
static constexpr size_t Num_Ops
const Def * rebuild_(World &, const Def *, Defs) const final
const Def * reduce(const Def *arg) const final
static constexpr auto Node
Pack * set(const Def *body)
Pack * stub(const Def *type)
constexpr size_t reduction_offset() const noexcept final
First Def::op that needs to be dealt with during reduction; e.g.
Base class for Sigma and Tuple.
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.
virtual const Def * reduce(const Def *arg) const =0
Seq * stub(World &w, const Def *type)
Def(World *, Node, const Def *type, Defs ops, flags_t flags)
Constructor for an immutable Def.
CRTP-based mixin to declare setters for Def::loc & Def::name using a covariant return type.
const Tuple * set(Loc l) const
Sigma * stub(const Def *type)
const Def * rebuild_(World &, const Def *, Defs) const final
constexpr size_t reduction_offset() const noexcept final
const Def * immutabilize() final
Tries to make an immutable from a mutable.
const Def * check() final
After all Def::ops have ben Def::set, this method will be invoked to check the type of this mutable.
Sigma * stub_(World &, const Def *) final
static const Def * infer(World &, Defs)
static constexpr auto Node
const Def * arity() const final
Sigma * set(size_t i, const Def *def)
static constexpr auto Node
The World represents the whole program and manages creation of MimIR nodes (Defs).
Vector< const Def * > DefVec
const Def * cat_tuple(nat_t n, nat_t m, const Def *a, const Def *b)
const Def * cat_sigma(nat_t n, nat_t m, const Def *a, const Def *b)