23 void pop() { old2news_.pop_back(); }
27 const Def*
map(
const Def* old_def,
const Def* new_def) {
return old2news_.back()[old_def] = new_def; }
32 for (
const auto& old2new : old2news_ | std::views::reverse)
33 if (
auto i = old2new.find(old_def); i != old2new.end())
return i->second;
53 std::deque<Def2Def> old2news_;
66 if (imm->local_vars().empty() && imm->local_muts().empty())
return imm;
72 if (vars_.has_intersection(mut->free_vars())) {
73 if (
auto var = mut->has_var()) vars_ =
world().
vars().insert(vars_, var);
A (possibly paramterized) Array.
This node is a hole in the IR that is inferred by its context later on.
A (possibly paramterized) Tuple.
virtual const Def * rewrite_hole(Hole *)
const Def * lookup(const Def *old_def)
Lookup old_def by searching in reverse through the stack of maps.
virtual const Def * rewrite_mut(Def *)
virtual const Def * rewrite_pack(const Pack *pack)
const Def * map(const Def *old_def, const Def *new_def)
Map old_def to new_def and returns new_def.
virtual const Def * rewrite_imm(const Def *)
virtual const Def * rewrite_seq(const Seq *)
virtual const Def * rewrite(const Def *)
virtual const Def * rewrite_extract(const Extract *)
virtual const Def * rewrite_arr(const Arr *arr)
Base class for Arr and Pack.
const Def * rewrite_mut(Def *mut) final
const Def * rewrite_imm(const Def *imm) final
VarRewriter(const Var *var, const Def *arg)
The World represents the whole program and manages creation of MimIR nodes (Defs).
DefMap< const Def * > Def2Def
Sets< const Var >::Set Vars