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.h>

Inheritance diagram for mim::Pass:
[legend]

Public Member Functions

Construction & Destruction
 Pass (World &world, std::string name)
 
 Pass (World &world, flags_t annex)
 
virtual void init (PassMan *)
 
Getters
PassManman ()
 
const PassManman () const
 
size_t index () const
 
Rewrite Hook for the PassMan

Rewrites an immutable def within PassMan::curr_mut.

Returns
the replacement.
virtual const Defrewrite (const Def *def)
 
virtual const Defrewrite (const Var *var)
 
virtual const Defrewrite (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 (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 Proxyproxy (const Def *type, Defs ops, u32 tag=0)
 
const Proxyisa_proxy (const Def *def, u32 tag=0)
 Check whether given def is a Proxy whose Proxy::pass matches this Pass's IPass::index.
 
const Proxyas_proxy (const Def *def, u32 tag=0)
 
- Public Member Functions inherited from mim::Stage
Worldworld ()
 
Driverdriver ()
 
Loglog () 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< Stagerecreate ()
 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)
 
- Protected Attributes inherited from mim::Stage
std::string name_
 

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 83 of file pass.h.

Constructor & Destructor Documentation

◆ Pass() [1/2]

mim::Pass::Pass ( World & world,
std::string name )
inline

◆ Pass() [2/2]

mim::Pass::Pass ( World & world,
flags_t annex )
inline

Definition at line 89 of file pass.h.

References mim::Stage::annex(), mim::Stage::Stage(), and mim::Stage::world().

Member Function Documentation

◆ alloc()

◆ analyze() [1/3]

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

◆ analyze() [2/3]

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

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.

◆ analyze() [3/3]

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

Reimplemented in mim::EtaRed.

Definition at line 117 of file pass.h.

References mim::No_Undo.

◆ as_proxy()

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

Definition at line 148 of file pass.h.

References index(), and proxy().

Referenced by mim::plug::mem::pass::SSA::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::direct::CPS2DS, mim::plug::mem::pass::Reshape, and mim::plug::mem::pass::SSA.

Definition at line 133 of file pass.h.

◆ fixed_point()

◆ index()

◆ init()

◆ inspect()

◆ isa_proxy()

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

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

◆ man() [1/2]

◆ man() [2/2]

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

Definition at line 98 of file pass.h.

References PassMan.

◆ prepare()

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

Invoked once before entering the main rewrite loop.

Definition at line 136 of file pass.h.

◆ proxy()

◆ rewrite() [1/3]

◆ rewrite() [2/3]

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

Reimplemented in mim::plug::mem::pass::SSA.

Definition at line 108 of file pass.h.

References proxy().

◆ rewrite() [3/3]

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

Definition at line 107 of file pass.h.

Friends And Related Symbol Documentation

◆ PassMan


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