8 for (
auto def :
old_world().externals().muts())
15 if (
auto [_, ins] = analyzed_.emplace(def); !ins)
return;
16 if (def->isa<
Var>())
return;
18 for (
auto d : def->
deps())
22void BetaRedPhase::visit(
const Def* def,
bool candidate) {
23 if (
auto lam = def->isa_mut<
Lam>()) {
24 if (
auto [i, ins] = candidates_.emplace(lam, candidate); !ins) i->second =
false;
31 DLOG(
"beta-reduce: `{}`", old_lam);
32 if (
auto var = old_lam->has_var()) {
38 return rewrite(old_lam->body());
41 return Rewriter::rewrite_imm_App(app);
const Def * callee() const
bool analyze() final
Runs the optional pre-analysis on RWPhase::old_world(), typically to a fixed point,...
const Def * rewrite_imm_App(const App *) final
bool is_set() const
Yields true if empty or the last op is set.
Defs deps() const noexcept
T * isa_mut() const
If this is mutable, it will cast constness away and perform a dynamic_cast to T.
void invalidate(bool todo=true)
Signals that another round of fixed-point iteration is required, either as part of.
World & old_world()
Get old Defs from here.
virtual const Def * map(const Def *old_def, const Def *new_def)
virtual const Def * rewrite(const Def *)
A variable introduced by a binder (mutable).
#define DLOG(...)
Vaporizes to nothingness in Debug build.