MimIR 0.1
MimIR is my Intermediate Representation
Loading...
Searching...
No Matches
mim::PassMan Class Reference

An optimizer that combines several optimizations in an optimal way. More...

#include <mim/pass.h>

Inheritance diagram for mim::PassMan:
[legend]

Public Member Functions

 PassMan (World &world, flags_t annex)
 
void apply (Passes &&)
 
void apply (const App *app) final
 Invoked if your Stage has additional args.
 
void apply (Stage &stage) final
 Dito, but invoked by Stage::recreate.
 
void init (PassMan *) final
 
bool inspect () const final
 Should the PassMan even consider this pass?
 
Getters
bool empty () const
 
const auto & passes () const
 
bool fixed_point () const
 
Defcurr_mut () const
 
Create and run Passes
void run ()
 Run all registered passes on the whole World.
 
Passfind (std::type_index key)
 
template<class P>
P * find ()
 
void add (std::unique_ptr< Pass > &&pass)
 
- Public Member Functions inherited from mim::Pass
 Pass (World &world, std::string name)
 
 Pass (World &world, flags_t annex)
 
PassManman ()
 
const PassManman () const
 
size_t index () const
 
virtual const Defrewrite (const Var *var)
 
virtual const Defrewrite (const Proxy *proxy)
 
virtual undo_t analyze (const Var *)
 
virtual undo_t analyze (const Proxy *)
 
virtual void enter ()
 Invoked just before Pass::rewriteing PassMan::curr_mut's body.
 
virtual void prepare ()
 Invoked once before entering the main rewrite loop.
 
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.
 

Friends

template<class P, class M>
class FPPass
 

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

An optimizer that combines several optimizations in an optimal way.

This is loosely based upon: "Composing dataflow analyses and transformations" by Lerner, Grove, Chambers.

Definition at line 172 of file pass.h.

Constructor & Destructor Documentation

◆ PassMan()

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

Definition at line 174 of file pass.h.

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

Referenced by apply(), apply(), and init().

Member Function Documentation

◆ add()

void mim::PassMan::add ( std::unique_ptr< Pass > && pass)
inline

Definition at line 207 of file pass.h.

References mim::error(), and find().

Referenced by apply().

◆ apply() [1/3]

void mim::PassMan::apply ( const App * )
finalvirtual

Invoked if your Stage has additional args.

Reimplemented from mim::Stage.

Definition at line 44 of file pass.cpp.

References apply(), mim::Stage::create(), mim::Stage::driver(), mim::Pass::Pass(), and passes().

◆ apply() [2/3]

void mim::PassMan::apply ( Passes && passes)

Definition at line 36 of file pass.cpp.

References add(), apply(), mim::Pass::man(), passes(), and PassMan().

Referenced by apply(), and apply().

◆ apply() [3/3]

void mim::PassMan::apply ( Stage & )
inlinefinalvirtual

Dito, but invoked by Stage::recreate.

Reimplemented from mim::Stage.

Definition at line 179 of file pass.h.

References apply(), and PassMan().

Referenced by apply().

◆ curr_mut()

Def * mim::PassMan::curr_mut ( ) const
inline

Definition at line 189 of file pass.h.

Referenced by mim::RWPass< P, M >::curr_mut(), and mim::RWPass< P, M >::inspect().

◆ empty()

bool mim::PassMan::empty ( ) const
inline

Definition at line 186 of file pass.h.

◆ find() [1/2]

template<class P>
P * mim::PassMan::find ( )
inline

Definition at line 202 of file pass.h.

References find().

Referenced by add(), and find().

◆ find() [2/2]

Pass * mim::PassMan::find ( std::type_index key)
inline

Definition at line 196 of file pass.h.

References mim::Pass::Pass().

◆ fixed_point()

bool mim::PassMan::fixed_point ( ) const
inlinevirtual

Reimplemented from mim::Pass.

Definition at line 188 of file pass.h.

◆ init()

void mim::PassMan::init ( PassMan * )
inlinefinalvirtual

Reimplemented from mim::Pass.

Definition at line 180 of file pass.h.

References PassMan().

◆ inspect()

bool mim::PassMan::inspect ( ) const
inlinefinalvirtual

Should the PassMan even consider this pass?

Implements mim::Pass.

Definition at line 182 of file pass.h.

◆ passes()

const auto & mim::PassMan::passes ( ) const
inline

Definition at line 187 of file pass.h.

Referenced by apply(), apply(), and run().

◆ run()

void mim::PassMan::run ( )

Run all registered passes on the whole World.

Definition at line 81 of file pass.cpp.

References mim::World::debug_dump(), mim::Def::deps(), DLOG, ILOG, mim::No_Undo, passes(), mim::pop(), mim::Phase::run(), mim::World::verify(), VLOG, and mim::Stage::world().

Friends And Related Symbol Documentation

◆ FPPass

template<class P, class M>
friend class FPPass
friend

Definition at line 286 of file pass.h.

References FPPass.

Referenced by FPPass.


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