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 Ref | rewrite (Ref def) |
virtual Ref | rewrite (const Var *var) |
virtual Ref | 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 (Ref) |
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 (Ref type, Defs ops, u32 tag=0) |
const Proxy * | isa_proxy (Ref def, u32 tag=0) |
Check whether given def is a Proxy whose Proxy::pass matches this Pass's IPass::index . | |
const Proxy * | as_proxy (Ref 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.
|
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::mem::CopyProp, and mim::plug::mem::SSAConstr.
Definition at line 52 of file pass.h.
References mim::No_Undo.
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.
Definition at line 82 of file pass.h.
References index(), mim::Proxy::pass(), proxy(), and mim::Proxy::tag().
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< 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(), mim::Proxy::pass(), proxy(), and mim::Proxy::tag().
Referenced by mim::plug::mem::SSAConstr::rewrite().
|
inline |
Definition at line 30 of file pass.h.
Referenced by mim::RWPass< P, M >::curr_mut(), mim::FPPass< P, M >::curr_undo(), mim::RWPass< P, M >::inspect(), mim::FPPass< P, M >::states(), mim::FPPass< P, M >::states(), mim::FPPass< P, M >::undo_visit(), and world().
|
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::plug::mem::SSAConstr.
Definition at line 42 of file pass.h.
References proxy().
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.
|
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::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().