MimIR 0.1
MimIR is my Intermediate Representation
|
All Passes that want to be registered in the PassMan must implement this interface. More...
#include <mim/pass.h>
Public Member Functions | |
Construction & Destruction | |
Pass (World &world, std::string name) | |
Pass (World &world, flags_t annex) | |
virtual void | init (PassMan *) |
Getters | |
PassMan & | man () |
const PassMan & | man () const |
size_t | index () const |
Rewrite Hook for the PassMan | |
Rewrites an immutable
| |
virtual const Def * | rewrite (const Def *def) |
virtual const Def * | rewrite (const Var *var) |
virtual const Def * | rewrite (const Proxy *proxy) |
Analyze Hook for the PassMan | |
Invoked after the PassMan has finished Pass::rewriteing PassMan::curr_mut to analyze the Def. Will only be invoked if Pass::fixed_point() yields
| |
virtual undo_t | analyze (const Def *) |
virtual undo_t | analyze (const Var *) |
virtual undo_t | analyze (const Proxy *) |
Further Hooks for the PassMan | |
virtual bool | fixed_point () const |
virtual bool | inspect () const =0 |
Should the PassMan even consider this pass? | |
virtual void | enter () |
Invoked just before Pass::rewriteing PassMan::curr_mut's body. | |
virtual void | prepare () |
Invoked once before entering the main rewrite loop. | |
proxy | |
const Proxy * | proxy (const Def *type, Defs ops, u32 tag=0) |
const Proxy * | isa_proxy (const Def *def, u32 tag=0) |
Check whether given def is a Proxy whose Proxy::pass matches this Pass's IPass::index . | |
const Proxy * | as_proxy (const Def *def, u32 tag=0) |
![]() | |
World & | world () |
Driver & | driver () |
Log & | log () const |
std::string_view | name () const |
flags_t | annex () const |
Stage (World &world, std::string name) | |
Stage (World &world, flags_t annex) | |
virtual | ~Stage ()=default |
virtual std::unique_ptr< Stage > | recreate () |
Creates a new instance; needed by a fixed-point PhaseMan. | |
virtual void | apply (const App *) |
Invoked if your Stage has additional args. | |
virtual void | apply (Stage &) |
Dito, but invoked by Stage::recreate. | |
Private Member Functions | |
Memory Management | |
virtual void * | alloc () |
Default constructor. | |
virtual void * | copy (const void *) |
Copy constructor. | |
virtual void | dealloc (void *) |
Destructor. | |
Friends | |
class | PassMan |
Additional Inherited Members | |
static auto | create (const Flags2Stages &stages, const Def *def) |
template<class A, class P> | |
static void | hook (Flags2Stages &stages) |
![]() | |
std::string | name_ |
All Passes that want to be registered in the PassMan must implement this interface.
|
inline |
Definition at line 87 of file pass.h.
References mim::Stage::name(), mim::Stage::Stage(), and mim::Stage::world().
Referenced by mim::PassMan::apply(), mim::PassMan::find(), mim::PassMan::PassMan(), mim::RWPass< P, M >::RWPass(), and mim::RWPass< P, M >::RWPass().
Definition at line 89 of file pass.h.
References mim::Stage::annex(), mim::Stage::Stage(), and mim::Stage::world().
|
inlineprivatevirtual |
Default constructor.
Reimplemented in mim::FPPass< P, M >, mim::FPPass< BetaRed, Def >, mim::FPPass< CopyProp, Lam >, mim::FPPass< EtaExp, Lam >, mim::FPPass< EtaRed, Def >, mim::FPPass< LowerTypedClosPrep, Lam >, mim::FPPass< SSA, Lam >, and mim::FPPass< TailRecElim, Lam >.
Reimplemented in mim::BetaRed, mim::EtaExp, mim::plug::clos::LowerTypedClosPrep, mim::plug::mem::pass::SSA, and mim::TailRecElim.
Definition at line 116 of file pass.h.
References mim::No_Undo.
Reimplemented in mim::BetaRed, mim::EtaExp, mim::plug::mem::pass::CopyProp, and mim::plug::mem::pass::SSA.
Definition at line 118 of file pass.h.
References mim::No_Undo.
Definition at line 148 of file pass.h.
References index(), and proxy().
Referenced by mim::plug::mem::pass::SSA::rewrite().
|
inlineprivatevirtual |
|
inlineprivatevirtual |
|
inlinevirtual |
Invoked just before Pass::rewriteing PassMan::curr_mut's body.
Reimplemented in mim::plug::clos::Clos2SJLJ, mim::plug::clos::ClosConvPrep, mim::plug::direct::CPS2DS, mim::plug::mem::pass::Reshape, and mim::plug::mem::pass::SSA.
|
inlinevirtual |
|
inline |
Definition at line 99 of file pass.h.
Referenced by as_proxy(), mim::plug::autodiff::Eval::augment_(), mim::plug::autodiff::Eval::augment_extract(), mim::FPPass< P, M >::data(), isa_proxy(), proxy(), and mim::plug::clos::BranchClosElim::rewrite().
|
virtual |
Reimplemented in mim::EtaExp, mim::PassMan, mim::plug::clos::ClosConvPrep, mim::plug::mem::pass::CopyProp, mim::plug::mem::pass::SSA, mim::Scalarize, and mim::TailRecElim.
Definition at line 30 of file pass.cpp.
References man(), and PassMan.
Referenced by mim::EtaExp::init(), mim::plug::clos::ClosConvPrep::init(), mim::plug::mem::pass::CopyProp::init(), mim::plug::mem::pass::SSA::init(), mim::Scalarize::init(), and mim::TailRecElim::init().
|
pure virtual |
Should the PassMan even consider this pass?
Implemented in mim::PassMan, mim::RWPass< P, M >, mim::RWPass< BetaRed, Def >, mim::RWPass< BranchClosElim, Lam >, mim::RWPass< Clos2SJLJ, Lam >, mim::RWPass< ClosConvPrep, Lam >, mim::RWPass< CopyProp, Lam >, mim::RWPass< CPS2DS, Lam >, mim::RWPass< DS2CPS, Lam >, mim::RWPass< EtaExp, Lam >, mim::RWPass< EtaRed, Def >, mim::RWPass< Eval, Lam >, mim::RWPass< LamSpec, Lam >, mim::RWPass< LowerMatrixHighLevelMapRed, Lam >, mim::RWPass< LowerMatrixMediumLevel, Lam >, mim::RWPass< LowerRegex, Lam >, mim::RWPass< LowerTypedClosPrep, Lam >, mim::RWPass< P, Def >, mim::RWPass< P, M >, mim::RWPass< P, M >, mim::RWPass< Reshape, Lam >, mim::RWPass< Scalarize, Lam >, mim::RWPass< SSA, Lam >, and mim::RWPass< TailRecElim, Lam >.
Check whether given def
is a Proxy whose Proxy::pass matches this Pass's IPass::index
.
Definition at line 143 of file pass.h.
References index(), and proxy().
Referenced by mim::plug::mem::pass::SSA::rewrite().
|
inline |
Definition at line 97 of file pass.h.
References PassMan.
Referenced by mim::PassMan::apply(), mim::RWPass< P, M >::curr_mut(), mim::FPPass< P, M >::curr_undo(), mim::EtaExp::init(), init(), mim::plug::clos::ClosConvPrep::init(), mim::plug::mem::pass::CopyProp::init(), mim::plug::mem::pass::SSA::init(), mim::Scalarize::init(), mim::TailRecElim::init(), mim::RWPass< P, M >::inspect(), mim::FPPass< P, M >::states(), mim::FPPass< P, M >::states(), and mim::FPPass< P, M >::undo_visit().
|
inline |
|
inlinevirtual |
Definition at line 141 of file pass.h.
References index(), mim::World::proxy(), and mim::Stage::world().
Referenced by mim::BetaRed::analyze(), mim::plug::mem::pass::CopyProp::analyze(), mim::plug::mem::pass::SSA::analyze(), as_proxy(), isa_proxy(), mim::EtaExp::proxy(), mim::BetaRed::rewrite(), rewrite(), mim::plug::mem::pass::CopyProp::rewrite(), mim::plug::mem::pass::SSA::rewrite(), and mim::plug::mem::pass::SSA::rewrite().
Reimplemented in mim::BetaRed, mim::EtaExp, mim::EtaRed, mim::LamSpec, mim::plug::autodiff::Eval, mim::plug::clos::BranchClosElim, mim::plug::clos::Clos2SJLJ, mim::plug::clos::ClosConvPrep, mim::plug::clos::LowerTypedClosPrep, mim::plug::direct::DS2CPS, mim::plug::matrix::LowerMatrixHighLevelMapRed, mim::plug::matrix::LowerMatrixMediumLevel, mim::plug::mem::pass::CopyProp, mim::plug::mem::pass::SSA, mim::plug::regex::LowerRegex, mim::Scalarize, and mim::TailRecElim.
Reimplemented in mim::plug::mem::pass::SSA.
Definition at line 108 of file pass.h.
References proxy().
|
friend |
Definition at line 166 of file pass.h.
References PassMan.
Referenced by init(), mim::plug::clos::ClosConvPrep::init(), mim::plug::mem::pass::CopyProp::init(), mim::plug::mem::pass::SSA::init(), man(), man(), and PassMan.