MimIR 0.1
MimIR is my Intermediate Representation
Loading...
Searching...
No Matches
mim::Pass Class Referenceabstract

All Passes that want to be registered in the PassMan must implement this interface. More...

#include <mim/pass/pass.h>

Inheritance diagram for mim::Pass:
[legend]

Public Member Functions

 Pass (PassMan &, std::string_view name)
 
virtual ~Pass ()=default
 
Getters
Worldworld ()
 
PassManman ()
 
const PassManman () const
 
std::string_view name () const
 
size_t index () const
 
Rewrite Hook for the PassMan

Rewrites an immutable def within PassMan::curr_mut.

Returns
the replacement.
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 true - which will be the case for FPPasses.

Returns
mim::No_Undo or the state to roll back to.
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 Proxyproxy (Ref type, Defs ops, u32 tag=0)
 
const Proxyisa_proxy (Ref def, u32 tag=0)
 Check whether given def is a Proxy whose Proxy::pass matches this Pass's IPass::index.
 
const Proxyas_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
 

Detailed Description

All Passes that want to be registered in the PassMan must implement this interface.

  • Inherit from RWPass if your pass does not need state and a fixed-point iteration.
  • Inherit from FPPass if you do need state and a fixed-point.
  • If you do not rely on interaction between different Passes, consider using Phase instead.

Definition at line 22 of file pass.h.

Constructor & Destructor Documentation

◆ Pass()

mim::Pass::Pass ( PassMan & man,
std::string_view name )

Definition at line 10 of file pass.cpp.

◆ ~Pass()

virtual mim::Pass::~Pass ( )
virtualdefault

Member Function Documentation

◆ alloc()

◆ analyze() [1/3]

virtual undo_t mim::Pass::analyze ( const Proxy * )
inlinevirtual

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.

◆ analyze() [2/3]

virtual undo_t mim::Pass::analyze ( const Var * )
inlinevirtual

Reimplemented in mim::EtaRed.

Definition at line 51 of file pass.h.

References mim::No_Undo.

◆ analyze() [3/3]

virtual undo_t mim::Pass::analyze ( Ref )
inlinevirtual

◆ as_proxy()

const Proxy * mim::Pass::as_proxy ( Ref def,
u32 tag = 0 )
inline

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().

◆ copy()

virtual void * mim::Pass::copy ( const void * )
inlineprivatevirtual

◆ dealloc()

◆ enter()

virtual void mim::Pass::enter ( )
inlinevirtual

Invoked just before Pass::rewriteing PassMan::curr_mut's body.

Note
This is invoked when seeing the inside of a mutable the first time. This is often too late, as you usually want to do something when you see a mutable the first time from the outside. This means that this PassMan::curr_mut has already been encountered elsewhere. Otherwise, we wouldn't have seen PassMan::curr_mut to begin with (unless it is Def::is_external).

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.

Definition at line 67 of file pass.h.

◆ fixed_point()

◆ index()

◆ inspect()

◆ isa_proxy()

const Proxy * mim::Pass::isa_proxy ( Ref def,
u32 tag = 0 )
inline

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().

◆ man() [1/2]

◆ man() [2/2]

const PassMan & mim::Pass::man ( ) const
inline

Definition at line 31 of file pass.h.

◆ name()

std::string_view mim::Pass::name ( ) const
inline

Definition at line 32 of file pass.h.

◆ prepare()

virtual void mim::Pass::prepare ( )
inlinevirtual

Invoked once before entering the main rewrite loop.

Reimplemented in DebugDump.

Definition at line 70 of file pass.h.

◆ proxy()

◆ rewrite() [1/3]

virtual Ref mim::Pass::rewrite ( const Proxy * proxy)
inlinevirtual

Reimplemented in mim::plug::mem::SSAConstr.

Definition at line 42 of file pass.h.

References proxy().

◆ rewrite() [2/3]

virtual Ref mim::Pass::rewrite ( const Var * var)
inlinevirtual

Definition at line 41 of file pass.h.

◆ rewrite() [3/3]

◆ world()

World & mim::Pass::world ( )
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().

Friends And Related Symbol Documentation

◆ PassMan

friend class PassMan
friend

Definition at line 101 of file pass.h.


The documentation for this class was generated from the following files: