|
MimIR 0.1
MimIR is my Intermediate Representation
|
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 Nest & | nest () 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 | |
| World & | world () |
| Driver & | driver () |
| Log & | log () 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< Stage > | recreate () |
| 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 |
| Lam * | root () const |
| Protected Attributes inherited from mim::Emitter< std::string, std::string, BB, Emitter > | |
| Lam * | curr_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_ |
| using mim::sexpr::Emitter::Super = mim::Emitter<std::string, std::string, BB, Emitter> |
|
inline |
Definition at line 71 of file sexpr.cpp.
References mim::Emitter< std::string, std::string, BB, Emitter >::ostream(), and mim::Stage::world().
Definition at line 500 of file sexpr.cpp.
References mim::sexpr::BB::assign(), emit_bb(), emit_node(), emit_type(), mim::error(), mim::Idx::isa(), mim::Lit::isa(), mim::Def::ops(), mim::print(), mim::Idx::size2bitwidth(), mim::Emitter< std::string, std::string, BB, Emitter >::tab, mim::Def::type(), and mim::Stage::world().
Referenced by emit_bb(), emit_head(), emit_node(), and emit_type().
| 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().
| void mim::sexpr::Emitter::emit_epilogue | ( | Lam * | lam | ) |
Definition at line 205 of file sexpr.cpp.
References mim::Lam::body(), mim::Emitter< std::string, std::string, BB, Emitter >::emit(), and mim::Emitter< std::string, std::string, BB, Emitter >::lam2bb_.
Definition at line 298 of file sexpr.cpp.
References mim::Pi::dom(), emit_bb(), emit_type(), emit_var(), mim::Lam::filter(), mim::Def::is_external(), mim::Lam::isa_cn(), mim::print(), mim::Emitter< std::string, std::string, BB, Emitter >::tab, mim::Lam::type(), and mim::Def::var().
Referenced by emit_lam().
| void mim::sexpr::Emitter::emit_imported | ( | Lam * | lam | ) |
Definition at line 193 of file sexpr.cpp.
References mim::Pi::dom(), emit_var(), mim::Def::is_external(), mim::print(), mim::Lam::type(), and mim::Def::var().
Definition at line 224 of file sexpr.cpp.
References mim::Def::deps(), emit_head(), emit_lam(), mim::Def::is_closed(), mim::Emitter< std::string, std::string, BB, Emitter >::lam2bb_, mim::Def::local_muts(), mim::NestPhase< Lam >::nest(), mim::print(), and mim::Emitter< std::string, std::string, BB, Emitter >::tab.
Referenced by emit_lam(), and finalize().
| std::string mim::sexpr::Emitter::emit_node | ( | BB & | bb, |
| const Def * | def, | ||
| std::string | node_name, | ||
| bool | variadic = false, | ||
| bool | with_type = false ) |
Definition at line 450 of file sexpr.cpp.
References mim::sexpr::BB::assign(), emit_bb(), emit_cons(), mim::Def::ops(), mim::print(), mim::Def::sym(), mim::Emitter< std::string, std::string, BB, Emitter >::tab, and mim::Def::type().
Referenced by emit_bb().
Definition at line 332 of file sexpr.cpp.
References mim::sexpr::BB::body(), emit_bb(), emit_type(), mim::error(), mim::Idx::isa(), mim::Lit::isa(), mim::Pi::isa_cn(), mim::print(), mim::Idx::size2bitwidth(), mim::Emitter< std::string, std::string, BB, Emitter >::types_, and mim::Stage::world().
Referenced by emit_bb(), emit_head(), emit_type(), and emit_var().
Definition at line 270 of file sexpr.cpp.
References emit_type(), emit_var(), mim::Def::projs(), and mim::Emitter< std::string, std::string, BB, Emitter >::tab.
Referenced by emit_head(), emit_imported(), and emit_var().
| void mim::sexpr::Emitter::finalize | ( | ) |
Definition at line 210 of file sexpr.cpp.
References mim::Def::as_mut(), emit_lam(), mim::Nest::Node::mut(), mim::NestPhase< Lam >::nest(), mim::ClosedMutPhase< Lam >::root(), and mim::Nest::root().
|
inline |
| std::string mim::sexpr::Emitter::prepare | ( | ) |
Definition at line 203 of file sexpr.cpp.
References mim::ClosedMutPhase< Lam >::root(), and mim::Def::unique_name().
|
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().