MimIR
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 typed=false, bool slotted=false)
bool direct_style () override
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 ()
LamSet next_lams (Lam *lam)
bool isa_nested_proj (const Extract *extract)
void emit_decl (BB &bb, const Def *def)
void emit_lam (Lam *parent, Lam *curr, LamSet &rec_lams)
std::string emit_var (BB &bb, const Def *var, const Def *type, bool meta_var=false)
std::string emit_head (BB &bb, Lam *lam, bool nested=false)
std::string emit_cons_type (BB &bb, View< const Def * > ops)
std::string emit_type (BB &bb, const Def *type, bool in_term=false)
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, bool schedule=false)
const Nestnest () const
Public Member Functions inherited from mim::ClosedMutPhase< Lam >
 ClosedMutPhase (World &world, std::string name, bool elide_empty, bool schedule=false)
bool elide_empty () const
bool schedule () const
Public Member Functions inherited from mim::Phase
 Phase (World &world, std::string name)
 Phase (World &world, flags_t annex)
bool todo () const
void invalidate (bool todo=true)
 Signals that another round of fixed-point iteration is required, either as part of.
virtual void run ()
 Entry point and generates some debug output; invokes Phase::start.
Public Member Functions inherited from mim::Stage
 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.
virtual bool redirects () const
 If true, Stage::create uses take_resolved().
virtual std::unique_ptr< Stagetake_resolved ()
 The Stage to use instead; nullptr means elide.
Worldworld ()
Driverdriver ()
Loglog () const
std::string_view name () const
flags_t annex () const

Additional Inherited Members

template<class P, class... Args>
static void run (Args &&... args)
 Runs a single Phase.
Static Public Member Functions inherited from mim::Stage
static std::unique_ptr< Stagecreate (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 >
fe::Tab tab
Protected Member Functions inherited from mim::Emitter< std::string, std::string, BB, Emitter >
 Emitter (World &world, std::string name, std::ostream &ostream, bool schedule=false)
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::Stage
std::string name_

Detailed Description

Definition at line 97 of file sexpr.cpp.

Member Typedef Documentation

◆ Super

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

Definition at line 99 of file sexpr.cpp.

Constructor & Destructor Documentation

◆ Emitter()

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

Member Function Documentation

◆ direct_style()

bool mim::sexpr::Emitter::direct_style ( )
inlineoverridevirtual

Reimplemented from mim::Emitter< std::string, std::string, BB, Emitter >.

Definition at line 110 of file sexpr.cpp.

◆ emit_bb()

◆ emit_cons()

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

Definition at line 769 of file sexpr.cpp.

References mim::Emitter< std::string, std::string, BB, Emitter >::tab.

Referenced by emit_node(), and emit_var().

◆ emit_cons_type()

std::string mim::sexpr::Emitter::emit_cons_type ( BB & bb,
View< const Def * > ops )

Definition at line 603 of file sexpr.cpp.

References emit_type().

Referenced by emit_type().

◆ emit_decl()

void mim::sexpr::Emitter::emit_decl ( BB & bb,
const Def * def )

Definition at line 367 of file sexpr.cpp.

References emit_bb(), emit_type(), emit_var(), mim::Def::isa_imm(), mim::Def::isa_mut(), and mim::Stage::world().

Referenced by emit_bb(), and emit_type().

◆ emit_epilogue()

◆ emit_head()

◆ emit_imported()

◆ 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,
bool meta_var = false )

◆ finalize()

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

◆ is_valid()

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

Definition at line 111 of file sexpr.cpp.

◆ isa_nested_proj()

bool mim::sexpr::Emitter::isa_nested_proj ( const Extract * extract)

Definition at line 341 of file sexpr.cpp.

References mim::Extract::index(), mim::Lit::isa(), isa_nested_proj(), and mim::Extract::tuple().

Referenced by emit_bb(), and isa_nested_proj().

◆ next_lams()

LamSet mim::sexpr::Emitter::next_lams ( Lam * lam)

Definition at line 330 of file sexpr.cpp.

References mim::Def::deps(), mim::NestPhase< Lam >::nest(), and next_lams().

Referenced by emit_lam(), and next_lams().

◆ prepare()

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

Definition at line 307 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 265 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: