21 template<
class P,
class... Args>
void add_pass(
const Def* def, Args&&... args) {
22 auto pass = (
Pass*)man->add<P>(std::forward<Args>(args)...);
26 template<
class P,
class... Args>
void add_phase(Args&&... args) {
27 assert(!man &&
"cannot add phase while in pass phase");
28 pipe->add<P>(std::forward<Args>(args)...);
40 absl::btree_map<const Def*, Pass*, GIDLt<const Def*>> def2pass_;
41 std::unique_ptr<PassMan> man;
42 std::unique_ptr<Pipeline> pipe;
64 auto pass_arg = (Q*)(builder.
pass(app->as<
App>()->
arg()));
65 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 add_pass(const Def *def, Args &&... args)
PipelineBuilder(World &world)
void add_phase(Args &&... args)
void def2pass(const Def *, Pass *p)
Organizes several Phases as a pipeline.
The World represents the whole program and manages creation of Thorin nodes (Defs).
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_with_arg(Passes &passes)
void register_pass(Passes &passes, CArgs &&... args)
void register_phase(Passes &passes, CArgs &&... args)
auto assert_emplace(C &container, Args &&... args)
Invokes emplace on container, asserts that insertion actually happened, and returns the iterator.
static constexpr flags_t Base