MimIR 0.1
MimIR is my Intermediate Representation
Loading...
Searching...
No Matches
mim::sexpr::Emitter Class Reference
Inheritance diagram for mim::sexpr::Emitter:
[legend]

Public Types

using Super = mim::Emitter<std::string, std::string, BB, Emitter>

Public Member Functions

 Emitter (World &world, std::ostream &ostream, bool slotted=false)
bool is_valid (std::string_view s)
void start () override
 Actual entry.
void emit_imported (Lam *)
std::string prepare ()
void emit_epilogue (Lam *)
void finalize ()
void emit_lam (Lam *lam, MutSet &done)
std::string emit_var (BB &bb, const Def *var, const Def *type)
std::string emit_head (BB &bb, Lam *lam, bool as_binding=false)
std::string emit_type (BB &bb, const Def *type)
std::string emit_cons (std::vector< std::string > op_vals)
std::string emit_node (BB &bb, const Def *def, std::string node_name, bool variadic=false, bool with_type=false)
std::string emit_bb (BB &bb, const Def *def)
Public Member Functions inherited from mim::NestPhase< Lam >
 NestPhase (World &world, std::string name, bool elide_empty)
const Nestnest () const
Public Member Functions inherited from mim::ClosedMutPhase< Lam >
 ClosedMutPhase (World &world, std::string name, bool elide_empty)
bool elide_empty () const
Public Member Functions inherited from mim::Phase
 Phase (World &world, std::string name)
 Phase (World &world, flags_t annex)
bool todo () const
virtual void run ()
 Entry point and generates some debug output; invokes Phase::start.
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.

Additional Inherited Members

template<class P, class... Args>
static void run (Args &&... args)
 Runs a single Phase.
static auto create (const Flags2Stages &stages, const Def *def)
template<class A, class P>
static void hook (Flags2Stages &stages)
Public Attributes inherited from mim::Emitter< std::string, std::string, BB, Emitter >
Tab tab
Protected Member Functions inherited from mim::Emitter< std::string, std::string, BB, Emitter >
 Emitter (World &world, std::string name, std::ostream &ostream)
std::ostream & ostream () const
std::string emit (const Def *def)
 Recursively emits code.
std::string emit_unsafe (const Def *def)
 As above but returning !child().is_valid(value) is permitted.
void visit (const Nest &nest) override
Protected Member Functions inherited from mim::ClosedMutPhase< Lam >
virtual void visit (Lam *)=0
Lamroot () const
Protected Attributes inherited from mim::Emitter< std::string, std::string, BB, Emitter >
Lamcurr_lam_
std::ostream & ostream_
Scheduler scheduler_
DefMap< std::string > locals_
DefMap< std::string > globals_
DefMap< std::string > types_
LamMap< BB > lam2bb_
Protected Attributes inherited from mim::Phase
bool todo_ = false
 Set to true to indicate that you want to rerun all Phasees in your current fixed-point PhaseMan.
Protected Attributes inherited from mim::Stage
std::string name_

Detailed Description

Definition at line 67 of file sexpr.cpp.

Member Typedef Documentation

◆ Super

using mim::sexpr::Emitter::Super = mim::Emitter<std::string, std::string, BB, Emitter>

Definition at line 69 of file sexpr.cpp.

Constructor & Destructor Documentation

◆ Emitter()

mim::sexpr::Emitter::Emitter ( World & world,
std::ostream & ostream,
bool slotted = false )
inline

Member Function Documentation

◆ emit_bb()

◆ emit_cons()

std::string mim::sexpr::Emitter::emit_cons ( std::vector< std::string > op_vals)

Definition at line 428 of file sexpr.cpp.

References mim::print(), and mim::Emitter< std::string, std::string, BB, Emitter >::tab.

Referenced by emit_node().

◆ emit_epilogue()

◆ emit_head()

std::string mim::sexpr::Emitter::emit_head ( BB & bb,
Lam * lam,
bool as_binding = false )

◆ emit_imported()

void mim::sexpr::Emitter::emit_imported ( Lam * lam)

◆ emit_lam()

◆ emit_node()

std::string mim::sexpr::Emitter::emit_node ( BB & bb,
const Def * def,
std::string node_name,
bool variadic = false,
bool with_type = false )

◆ emit_type()

◆ emit_var()

std::string mim::sexpr::Emitter::emit_var ( BB & bb,
const Def * var,
const Def * type )

◆ finalize()

void mim::sexpr::Emitter::finalize ( )

◆ is_valid()

bool mim::sexpr::Emitter::is_valid ( std::string_view s)
inline

Definition at line 76 of file sexpr.cpp.

◆ prepare()

std::string mim::sexpr::Emitter::prepare ( )

Definition at line 203 of file sexpr.cpp.

References mim::ClosedMutPhase< Lam >::root(), and mim::Def::unique_name().

◆ start()

void mim::sexpr::Emitter::start ( )
overridevirtual

Actual entry.

Reimplemented from mim::ClosedMutPhase< Lam >.

Definition at line 181 of file sexpr.cpp.

References mim::Emitter< std::string, std::string, BB, Emitter >::ostream(), and mim::Phase::start().


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