17 static constexpr size_t Num_Ops = std::dynamic_extent;
26 Sigma(
const Def*
type,
size_t size)
34 Sigma*
set(
size_t i,
const Def* def) {
return Def::set(i, def)->as<Sigma>(); }
147 const Def* immutabilize() final;
154 const Def* check(
size_t,
const Def*)
final;
155 const Def* check() final;
194 const Def* immutabilize() final;
210class Extract :
public Def,
public Setters<Extract> {
237class Insert :
public Def,
public Setters<Insert> {
240 : Def(
Node,
tuple->type(), {tuple, index, value}, 0) {}
269 explicit operator bool() const noexcept {
return extract_; }
278 const Extract* extract_ =
nullptr;
287 explicit operator bool() const noexcept {
return app_; }
290 const Def* callee()
const;
291 const Def* arg()
const;
294 const App* app_ =
nullptr;
312 explicit operator bool() const noexcept {
return app_; }
315 const Def* callee()
const;
316 const Def* arg()
const;
326 const App* app_ =
nullptr;
327 const Extract* extract_ =
nullptr;
332bool is_unit(
const Def*);
333std::string tuple2str(
const Def*);
335const Def* tuple_of_types(
const Def* t);
341DefVec cat(Defs, Defs);
345DefVec cat(nat_t n, nat_t m,
const Def* a,
const Def* b);
347const Def* cat_tuple(nat_t n, nat_t m,
const Def* a,
const Def* b);
348const Def* cat_sigma(nat_t n, nat_t m,
const Def* a,
const Def* b);
350const Def* cat_tuple(World&, Defs, Defs);
351const Def* cat_sigma(World&, Defs, Defs);
A (possibly paramterized) Array.
const Def * arity() const final
Number of elements available to Extract / Insert (may be dynamic).
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
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
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
Number of elements available to Extract / Insert (may be dynamic).
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 been 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
Number of elements available to Extract / Insert (may be dynamic).
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)