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 tt_; }
270 const Def*
tt()
const {
return tt_; }
271 const Def*
ff()
const {
return ff_; }
274 const Extract* extract_ =
nullptr;
275 const Def* pair_ =
nullptr;
276 const Def* cond_ =
nullptr;
277 const Def* tt_ =
nullptr;
278 const Def* ff_ =
nullptr;
292 const App* app_ =
nullptr;
293 const Def* callee_ =
nullptr;
294 const Def* arg_ =
nullptr;
299bool is_unit(
const Def*);
300std::string tuple2str(
const Def*);
303const Def* flatten(
const Def* def);
305size_t flatten(DefVec& ops,
const Def* def,
bool flatten_sigmas =
true);
308const Def* unflatten(
const Def* def,
const Def* type);
310const Def* unflatten(Defs ops,
const Def* type,
bool flatten_muts =
true);
312DefVec merge(Defs, Defs);
313DefVec merge(
const Def* def, Defs defs);
314const Def* merge_sigma(
const Def* def, Defs defs);
315const Def* merge_tuple(
const Def* def, Defs defs);
317const Def* tuple_of_types(
const Def* t);
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)
const Def * callee() const
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 * 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
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).