Thorin 1.9.0
The Higher ORder INtermediate representation
Loading...
Searching...
No Matches
thorin::Pass Class Referenceabstract

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

#include <thorin/pass/pass.h>

Inheritance diagram for thorin::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
thorin::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.
 

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

thorin::Pass::Pass ( PassMan man,
std::string_view  name 
)

Definition at line 10 of file pass.cpp.

◆ ~Pass()

virtual thorin::Pass::~Pass ( )
virtualdefault

Member Function Documentation

◆ alloc()

◆ analyze() [1/3]

virtual undo_t thorin::Pass::analyze ( const Proxy )
inlinevirtual

Reimplemented in thorin::BetaRed, thorin::EtaExp, thorin::plug::mem::CopyProp, and thorin::plug::mem::SSAConstr.

Definition at line 52 of file pass.h.

References thorin::No_Undo.

◆ analyze() [2/3]

virtual undo_t thorin::Pass::analyze ( const Var )
inlinevirtual

Reimplemented in thorin::EtaRed.

Definition at line 51 of file pass.h.

References thorin::No_Undo.

◆ analyze() [3/3]

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

◆ as_proxy()

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

Definition at line 82 of file pass.h.

References index(), thorin::Proxy::pass(), proxy(), and thorin::Proxy::tag().

Referenced by thorin::plug::mem::SSAConstr::rewrite().

◆ copy()

◆ dealloc()

◆ enter()

virtual void thorin::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 thorin::RetWrap, thorin::plug::clos::Clos2SJLJ, thorin::plug::clos::ClosConvPrep, thorin::plug::compile::DebugPrint, thorin::plug::compile::InternalCleanup, thorin::plug::direct::CPS2DS, thorin::plug::mem::Reshape, and thorin::plug::mem::SSAConstr.

Definition at line 67 of file pass.h.

◆ fixed_point()

◆ index()

◆ inspect()

◆ isa_proxy()

const Proxy * thorin::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(), thorin::Proxy::pass(), proxy(), and thorin::Proxy::tag().

Referenced by thorin::plug::mem::SSAConstr::rewrite().

◆ man() [1/2]

◆ man() [2/2]

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

Definition at line 31 of file pass.h.

◆ name()

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

Definition at line 32 of file pass.h.

◆ prepare()

virtual void thorin::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 thorin::Pass::rewrite ( const Proxy proxy)
inlinevirtual

Reimplemented in thorin::plug::mem::SSAConstr.

Definition at line 42 of file pass.h.

References proxy().

◆ rewrite() [2/3]

virtual Ref thorin::Pass::rewrite ( const Var var)
inlinevirtual

Definition at line 41 of file pass.h.

◆ rewrite() [3/3]

◆ world()

World & thorin::Pass::world ( )
inline

Definition at line 296 of file pass.h.

References man(), and thorin::PassMan::world().

Referenced by thorin::BetaRed::analyze(), thorin::EtaExp::analyze(), thorin::plug::mem::CopyProp::analyze(), thorin::plug::mem::SSAConstr::analyze(), thorin::EtaRed::analyze(), thorin::BetaRed::analyze(), thorin::EtaExp::analyze(), thorin::TailRecElim::analyze(), thorin::plug::clos::LowerTypedClosPrep::analyze(), thorin::plug::mem::SSAConstr::analyze(), thorin::plug::autodiff::AutoDiffEval::augment_(), thorin::plug::autodiff::AutoDiffEval::augment_app(), thorin::plug::autodiff::AutoDiffEval::augment_extract(), thorin::plug::autodiff::AutoDiffEval::augment_lam(), thorin::plug::autodiff::AutoDiffEval::augment_pack(), thorin::plug::autodiff::AutoDiffEval::augment_tuple(), thorin::plug::autodiff::AutoDiffEval::derive_(), thorin::RetWrap::enter(), thorin::plug::clos::ClosConvPrep::enter(), thorin::plug::compile::DebugPrint::enter(), thorin::plug::compile::InternalCleanup::enter(), thorin::plug::clos::ClosConvPrep::eta_wrap(), DebugDump::prepare(), proxy(), thorin::plug::mem::SSAConstr::rewrite(), thorin::BetaRed::rewrite(), thorin::EtaRed::rewrite(), thorin::LamSpec::rewrite(), thorin::TailRecElim::rewrite(), thorin::plug::affine::LowerFor::rewrite(), thorin::plug::autodiff::AutoDiffEval::rewrite(), thorin::plug::autodiff::AutoDiffZero::rewrite(), thorin::plug::autodiff::AutoDiffZeroCleanup::rewrite(), thorin::plug::clos::BranchClosElim::rewrite(), thorin::plug::clos::LowerTypedClosPrep::rewrite(), thorin::plug::direct::DS2CPS::rewrite(), thorin::plug::mem::CopyProp::rewrite(), thorin::plug::mem::SSAConstr::rewrite(), thorin::plug::refly::RemoveDbgPerm::rewrite(), thorin::plug::matrix::LowerMatrixHighLevelMapRed::rewrite_(), thorin::plug::matrix::LowerMatrixMediumLevel::rewrite_(), thorin::plug::clos::ClosConvPrep::rewrite_arg(), and thorin::plug::clos::ClosConvPrep::rewrite_callee().


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