template <PhaseStrategy S> class PhaseRunner;
-template <> class PhaseRunner<PhaseStrategy::Saturate>
+template <> class PhaseRunner<PhaseStrategy::Saturate> final : public PhaseRunnerMixinObservable
{
public:
PhaseRunner(loco::Graph *graph) : _graph{graph}
loco::Graph *_graph;
};
-template <> class PhaseRunner<PhaseStrategy::Restart>
+template <> class PhaseRunner<PhaseStrategy::Restart> final : public PhaseRunnerMixinObservable
{
public:
PhaseRunner(loco::Graph *graph) : _graph{graph}
void PhaseRunner<PhaseStrategy::Saturate>::run(const Phase &phase) const
{
+ notifyPhaseBegin();
+
for (bool changed = true; changed;)
{
changed = false;
for (auto &pass : phase)
{
+ notifyPassBegin(pass.get());
+
bool pass_changed = pass->run(_graph);
changed = changed || pass_changed;
+
+ notifyPassEnd(pass.get(), pass_changed);
}
}
+
+ notifyPhaseEnd();
}
void PhaseRunner<PhaseStrategy::Restart>::run(const Phase &phase) const
{
+ notifyPhaseBegin();
+
for (bool changed = true; changed;)
{
changed = false;
for (auto &pass : phase)
{
+ notifyPassBegin(pass.get());
+
bool pass_changed = pass->run(_graph);
changed = changed || pass_changed;
+ notifyPassEnd(pass.get(), pass_changed);
+
if (changed)
{
break;
}
}
}
+
+ notifyPhaseEnd();
}
} // namespace logo