11 if (
auto app = part->isa<
App>()) {
12 if (
auto lam = app->callee()->isa<
Lam>()) {
13 part = lam->
reduce(app->arg())[1];
14 world.DLOG(
"reduce pass/phase lambda {} to {} : {}", lam, part, part->
type());
19 world.DLOG(
"pass/phase: {}", phase_def);
20 if (
auto phase_ax = phase_def->isa<
Axiom>()) {
21 auto flag = phase_ax->
flags();
22 if (passes.contains(flag)) {
23 auto phase_fun = passes[flag];
24 phase_fun(world, builder, part);
26 world.WLOG(
"pass/phase '{}' not found", phase_ax->sym());
27 assert(passes.contains(flag) &&
"pass/phase not found");
29 }
else if (phase_def->isa<
Lam>()) {
30 assert(0 &&
"curried lambas are not supported");
32 world.WLOG(
"pass/phase '{}' is not an axiom", phase_def);
33 assert(phase_def->isa<
Axiom>() &&
"pass/phase is not an axiom");
const Def * type() const
Yields the raw type of this Def, i.e. maybe nullptr.
DefVec reduce(const Def *arg) const
Rewrites Def::ops by substituting this mutable's Var with arg.
The World represents the whole program and manages creation of Thorin nodes (Defs).
Flags & flags()
Retrive compile Flags.
void handle_optimization_part(const Def *part, World &world, Passes &passes, PipelineBuilder &builder)
absl::flat_hash_map< flags_t, std::function< void(World &, PipelineBuilder &, const Def *)> > Passes
axiom ↦ (pipeline part) × (axiom application) → () The function should inspect Application to const...
std::pair< const Def *, std::vector< const Def * > > collect_args(const Def *def)
Helper function to cope with the fact that normalizers take all arguments and not only its axiom argu...