16template<
class A,
class P>
25 auto res = fe::Vector<const Nest::Node*>(scc.begin(), scc.end());
35 Unknowns(
World& world)
39 void unknown(
Lam* lam)
final { lams.emplace(lam); }
42 auto funs = fe::Vector<Def*>();
49 if (
auto lam = fun->as<
Lam>(); !unknowns.lams.contains(lam) && !nest[lam]->is_recursive()) res.emplace(lam);
Traverses the current World using Rewriter infrastructure while staying in the same world.
const fe::Vector< std::string > & args(std::string_view plugin) const
Yields an empty fe::Vector if plugin has none.
static Lam * isa_mut_cn(const Def *d)
GIDSet< const Node * > SCC
Strongly Connected Component.
uint32_t gid() const
Stable id for deterministic hashing/ordering: the underlying mut's gid, or 0 for the (unique) virtual...
Phase(World &world, std::string name)
The World represents the whole program and manages creation of MimIR nodes (Defs).
void for_each(bool elide_empty, std::function< void(Def *)>, bool schedule=false)
void start() override
Actual entry.
FunPhase(World &world, flags_t annex, const Target &target)
const LamSet & known() const
The functions with a convention of their own, see mach::known.
const Target & target() const
const fe::Vector< std::string > & target_args()
The arguments -X <backend>:<arg> of the Target's backend plugin.
virtual void visit(Lam *)=0
The machine facts of a native backend that the phases of mach need.
static const Target & of(Driver &driver)
The Target of the one loaded backend; every backend's Target is a mach::Target.
fe::Vector< const Nest::Node * > sorted(const Nest::Node::SCC &scc)
The Nodes of scc in a deterministic order.
LamSet known(World &world)
The closed Cns with a body that get a convention of their own instead of the ABI.
void hook(Flags2Phases &phases)
Registers the Phase P for the annex A, constructed with the Target of the one loaded backend.
ankerl::unordered_dense::map< flags_t, std::function< std::unique_ptr< Phase >(World &)> > Flags2Phases
Maps an axiom of a Phase to a function that creates one.
static consteval flags_t base()