20 template<
class P,
class... Args>
void add_pass(
const Def* def, Args&&... args) {
21 auto pass = (
Pass*)man->add<P>(std::forward<Args>(args)...);
25 template<
class P,
class... Args>
void add_phase(Args&&... args) {
26 assert(!man &&
"cannot add phase while in pass phase");
27 pipe->add<P>(std::forward<Args>(args)...);
39 absl::btree_map<const Def*, Pass*, GIDLt<const Def*>> def2pass_;
40 std::unique_ptr<PassMan> man;
41 std::unique_ptr<Pipeline> pipe;
63 auto pass_arg = (Q*)(builder.
pass(app->as<
App>()->
arg()));
64 world.DLOG(
"register using arg: {} of type {} for gid {}", pass_arg,
typeid(Q).name(),
All Passes that want to be registered in the PassMan must implement this interface.
void def2pass(const Def *, Pass *p)
PipelineBuilder(World &world)
void add_phase(Args &&... args)
void add_pass(const Def *def, Args &&... args)
Organizes several Phases as a pipeline.
The World represents the whole program and manages creation of MimIR nodes (Defs).
auto assert_emplace(C &container, Args &&... args)
Invokes emplace on container, asserts that insertion actually happened, and returns the iterator.
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...
void register_pass(Passes &passes, CArgs &&... args)
void register_pass_with_arg(Passes &passes)
void register_phase(Passes &passes, CArgs &&... args)
static constexpr flags_t Base