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/pass.h>
Public Member Functions | |
Pass (PassMan &, std::string_view name) | |
virtual | ~Pass ()=default |
Getters | |
World & | world () |
PassMan & | man () |
const PassMan & | man () const |
std::string_view | name () 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) |
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 |
All Passes that want to be registered in the PassMan must implement this interface.
mim::Pass::Pass | ( | PassMan & | man, |
std::string_view | name ) |
|
virtualdefault |
|
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< SSAConstr, Lam >, and mim::FPPass< TailRecElim, Lam >.
Reimplemented in mim::BetaRed, mim::EtaExp, mim::plug::clos::LowerTypedClosPrep, mim::plug::mem::SSAConstr, and mim::TailRecElim.
Definition at line 50 of file pass.h.
References mim::No_Undo.
Reimplemented in mim::BetaRed, mim::EtaExp, mim::plug::mem::CopyProp, and mim::plug::mem::SSAConstr.
Definition at line 52 of file pass.h.
References mim::No_Undo.
Definition at line 82 of file pass.h.
References index(), and proxy().
Referenced by mim::plug::mem::SSAConstr::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::compile::DebugPrint, mim::plug::compile::InternalCleanup, mim::plug::direct::CPS2DS, mim::plug::mem::Reshape, mim::plug::mem::SSAConstr, and mim::RetWrap.
|
inlinevirtual |
|
inline |
Definition at line 33 of file pass.h.
Referenced by as_proxy(), mim::plug::autodiff::AutoDiffEval::augment_(), mim::plug::autodiff::AutoDiffEval::augment_extract(), mim::FPPass< P, M >::data(), isa_proxy(), proxy(), and mim::plug::clos::BranchClosElim::rewrite().
|
pure virtual |
Should the PassMan even consider this pass?
Implemented in mim::RWPass< P, M >, mim::RWPass< Alloc2Malloc, Lam >, mim::RWPass< AutoDiffEval, Lam >, mim::RWPass< AutoDiffZero, Lam >, mim::RWPass< AutoDiffZeroCleanup, Lam >, 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< DebugDump, Lam >, mim::RWPass< DebugPrint, Lam >, mim::RWPass< DS2CPS, Lam >, mim::RWPass< EtaExp, Lam >, mim::RWPass< EtaRed, Def >, mim::RWPass< InternalCleanup, Lam >, mim::RWPass< LamSpec, Lam >, mim::RWPass< LowerFor, 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< RememElim, Lam >, mim::RWPass< RemoveDbgPerm, Lam >, mim::RWPass< Reshape, Lam >, mim::RWPass< RetWrap, Lam >, mim::RWPass< Scalarize, Lam >, mim::RWPass< SSAConstr, 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 77 of file pass.h.
References index(), and proxy().
Referenced by mim::plug::mem::SSAConstr::rewrite().
|
inline |
Definition at line 30 of file pass.h.
References PassMan.
Referenced by mim::plug::mem::Alloc2Malloc::Alloc2Malloc(), mim::plug::autodiff::AutoDiffEval::AutoDiffEval(), mim::plug::autodiff::AutoDiffZero::AutoDiffZero(), mim::plug::autodiff::AutoDiffZeroCleanup::AutoDiffZeroCleanup(), mim::BetaRed::BetaRed(), mim::plug::clos::BranchClosElim::BranchClosElim(), mim::plug::clos::Clos2SJLJ::Clos2SJLJ(), mim::plug::clos::ClosConvPrep::ClosConvPrep(), mim::plug::mem::CopyProp::CopyProp(), mim::plug::direct::CPS2DS::CPS2DS(), mim::RWPass< P, M >::curr_mut(), mim::FPPass< P, M >::curr_undo(), DebugDump::DebugDump(), mim::plug::compile::DebugPrint::DebugPrint(), mim::plug::direct::DS2CPS::DS2CPS(), mim::EtaExp::EtaExp(), mim::EtaRed::EtaRed(), mim::FPPass< P, M >::FPPass(), mim::RWPass< P, M >::inspect(), mim::plug::compile::InternalCleanup::InternalCleanup(), mim::LamSpec::LamSpec(), mim::plug::affine::LowerFor::LowerFor(), mim::plug::matrix::LowerMatrixHighLevelMapRed::LowerMatrixHighLevelMapRed(), mim::plug::matrix::LowerMatrixMediumLevel::LowerMatrixMediumLevel(), mim::plug::regex::LowerRegex::LowerRegex(), mim::plug::clos::LowerTypedClosPrep::LowerTypedClosPrep(), Pass(), mim::plug::mem::RememElim::RememElim(), mim::plug::refly::RemoveDbgPerm::RemoveDbgPerm(), mim::plug::mem::Reshape::Reshape(), mim::RetWrap::RetWrap(), mim::RWPass< P, M >::RWPass(), mim::Scalarize::Scalarize(), mim::plug::mem::SSAConstr::SSAConstr(), mim::FPPass< P, M >::states(), mim::FPPass< P, M >::states(), mim::TailRecElim::TailRecElim(), mim::FPPass< P, M >::undo_visit(), and world().
|
inline |
|
inline |
Definition at line 32 of file pass.h.
Referenced by mim::FPPass< P, M >::FPPass(), Pass(), and mim::RWPass< P, M >::RWPass().
|
inlinevirtual |
Definition at line 75 of file pass.h.
References index(), mim::World::proxy(), and world().
Referenced by mim::BetaRed::analyze(), mim::plug::mem::CopyProp::analyze(), mim::plug::mem::SSAConstr::analyze(), as_proxy(), isa_proxy(), mim::EtaExp::proxy(), mim::BetaRed::rewrite(), rewrite(), mim::plug::mem::CopyProp::rewrite(), mim::plug::mem::SSAConstr::rewrite(), and mim::plug::mem::SSAConstr::rewrite().
Reimplemented in mim::BetaRed, mim::EtaExp, mim::EtaRed, mim::LamSpec, mim::plug::affine::LowerFor, mim::plug::autodiff::AutoDiffEval, mim::plug::autodiff::AutoDiffZero, mim::plug::autodiff::AutoDiffZeroCleanup, 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::Alloc2Malloc, mim::plug::mem::CopyProp, mim::plug::mem::RememElim, mim::plug::mem::SSAConstr, mim::plug::refly::RemoveDbgPerm, mim::plug::regex::LowerRegex, mim::Scalarize, and mim::TailRecElim.
Reimplemented in mim::plug::mem::SSAConstr.
Definition at line 42 of file pass.h.
References proxy().
|
inline |
Definition at line 296 of file pass.h.
References man(), and mim::PassMan::world().
Referenced by mim::BetaRed::analyze(), mim::BetaRed::analyze(), mim::EtaExp::analyze(), mim::EtaExp::analyze(), mim::EtaRed::analyze(), mim::plug::clos::LowerTypedClosPrep::analyze(), mim::plug::mem::CopyProp::analyze(), mim::plug::mem::SSAConstr::analyze(), mim::plug::mem::SSAConstr::analyze(), mim::TailRecElim::analyze(), mim::plug::autodiff::AutoDiffEval::augment_(), mim::plug::autodiff::AutoDiffEval::augment_app(), mim::plug::autodiff::AutoDiffEval::augment_extract(), mim::plug::autodiff::AutoDiffEval::augment_lam(), mim::plug::autodiff::AutoDiffEval::augment_pack(), mim::plug::autodiff::AutoDiffEval::augment_tuple(), mim::plug::autodiff::AutoDiffEval::derive_(), mim::plug::clos::Clos2SJLJ::enter(), mim::plug::clos::ClosConvPrep::enter(), mim::plug::compile::DebugPrint::enter(), mim::plug::compile::InternalCleanup::enter(), mim::RetWrap::enter(), mim::plug::clos::ClosConvPrep::eta_wrap(), DebugDump::prepare(), proxy(), mim::BetaRed::rewrite(), mim::EtaRed::rewrite(), mim::LamSpec::rewrite(), mim::plug::affine::LowerFor::rewrite(), mim::plug::autodiff::AutoDiffEval::rewrite(), mim::plug::autodiff::AutoDiffZero::rewrite(), mim::plug::autodiff::AutoDiffZeroCleanup::rewrite(), mim::plug::clos::BranchClosElim::rewrite(), mim::plug::clos::Clos2SJLJ::rewrite(), mim::plug::clos::LowerTypedClosPrep::rewrite(), mim::plug::direct::DS2CPS::rewrite(), mim::plug::mem::CopyProp::rewrite(), mim::plug::mem::SSAConstr::rewrite(), mim::plug::mem::SSAConstr::rewrite(), mim::plug::refly::RemoveDbgPerm::rewrite(), mim::plug::regex::LowerRegex::rewrite(), mim::Scalarize::rewrite(), mim::TailRecElim::rewrite(), mim::plug::matrix::LowerMatrixHighLevelMapRed::rewrite_(), mim::plug::matrix::LowerMatrixMediumLevel::rewrite_(), mim::plug::clos::ClosConvPrep::rewrite_arg(), and mim::plug::clos::ClosConvPrep::rewrite_callee().
|
friend |
Definition at line 101 of file pass.h.
References PassMan.
Referenced by mim::plug::mem::Alloc2Malloc::Alloc2Malloc(), mim::plug::autodiff::AutoDiffEval::AutoDiffEval(), mim::plug::autodiff::AutoDiffZero::AutoDiffZero(), mim::plug::autodiff::AutoDiffZeroCleanup::AutoDiffZeroCleanup(), mim::plug::clos::BranchClosElim::BranchClosElim(), mim::plug::clos::Clos2SJLJ::Clos2SJLJ(), mim::plug::clos::ClosConvPrep::ClosConvPrep(), mim::plug::mem::CopyProp::CopyProp(), mim::plug::direct::CPS2DS::CPS2DS(), mim::plug::compile::DebugPrint::DebugPrint(), mim::plug::direct::DS2CPS::DS2CPS(), mim::plug::compile::InternalCleanup::InternalCleanup(), mim::plug::affine::LowerFor::LowerFor(), mim::plug::matrix::LowerMatrixHighLevelMapRed::LowerMatrixHighLevelMapRed(), mim::plug::matrix::LowerMatrixMediumLevel::LowerMatrixMediumLevel(), mim::plug::regex::LowerRegex::LowerRegex(), mim::plug::clos::LowerTypedClosPrep::LowerTypedClosPrep(), man(), man(), Pass(), PassMan, mim::plug::mem::RememElim::RememElim(), mim::plug::refly::RemoveDbgPerm::RemoveDbgPerm(), mim::plug::mem::Reshape::Reshape(), mim::RWPass< P, M >::RWPass(), and mim::plug::mem::SSAConstr::SSAConstr().