12 for (
const auto& [_, def] :
world().annexes())
rewrite(def);
14 for (
const auto& [_, mut] : externals) mut->transfer_external(
rewrite(mut)->as_mut());
18 for (
bool todo =
true; todo;) {
30 for (
const auto& [f, def] :
world().annexes()) new_world.register_annex(f, rewriter.
rewrite(def));
31 for (
const auto& [_, mut] :
world().externals()) {
33 new_mut->make_external();
36 swap(
world(), new_world);
40 for (
auto& phase :
phases()) phase->run();
45 for (
const auto& [
name, mut] :
world().externals()) muts.
push(mut);
47 while (!muts.
empty()) {
48 auto mut = muts.
pop();
49 if (elide_empty_ && !mut->is_set())
continue;
void start() override
Actual entry.
T * as_mut() const
Asserts that this is a mutable, casts constness away and performs a static_cast to T.
void start() override
Actual entry.
virtual void run()
Entry point and generates some debug output; invokes Phase::start.
std::string_view name() const
virtual void start()=0
Actual entry.
void start() override
Actual entry.
const auto & phases() const
void start() override
Actual entry.
Recurseivly rewrites part of a program into the provided World.
virtual void visit(const Scope &)=0
const Scope & scope() const
void start() override
Actual entry.
A Scope represents a region of Defs that are live from the view of an entry's Var.
const MutSet & free_muts() const
All muts that occurr free in this Scope.
World & verify()
Verifies that all externals() and annexes() are Def::is_closed(), if MIM_ENABLE_CHECKS.
const auto & externals() const