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 | is_valid (std::string_view s) |
void | start () override |
Actual entry. | |
void | emit_imported (Lam *) |
void | emit_epilogue (Lam *) |
std::string | emit_bb (BB &, const Def *) |
std::string | prepare (const Scope &) |
void | prepare (Lam *, std::string_view) |
void | finalize (const Scope &) |
template<class... Args> | |
void | declare (const char *s, Args &&... args) |
Public Member Functions inherited from mim::ScopePhase | |
ScopePhase (World &world, std::string_view name, bool elide_empty) | |
void | start () override |
Actual entry. | |
Public Member Functions inherited from mim::Phase | |
Phase (World &world, std::string_view name, bool dirty) | |
virtual | ~Phase ()=default |
World & | world () |
std::string_view | name () const |
bool | is_dirty () const |
virtual void | run () |
Entry point and generates some debug output; invokes Phase::start. | |
Additional Inherited Members | |
Static Public Member Functions inherited from mim::Phase | |
template<class P , class... Args> | |
static void | run (Args &&... args) |
Runs a single Phase. | |
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_view 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 Scope &scope) override |
Protected Member Functions inherited from mim::ScopePhase | |
const Scope & | scope () const |
Protected Member Functions inherited from mim::Phase | |
Protected Attributes inherited from mim::Emitter< std::string, std::string, BB, Emitter > | |
std::ostream & | ostream_ |
Scheduler | scheduler_ |
DefMap< std::string > | locals_ |
DefMap< std::string > | globals_ |
DefMap< std::string > | types_ |
LamMap< BB > | lam2bb_ |
Lam * | entry_ |
Protected Attributes inherited from mim::Phase | |
World & | world_ |
std::string | name_ |
bool | dirty_ |
using mim::ll::Emitter::Super = mim::Emitter<std::string, std::string, BB, Emitter> |
|
inline |
|
inline |
Definition at line 131 of file ll.cpp.
References mim::print().
Referenced by emit_bb(), and emit_epilogue().
Definition at line 458 of file ll.cpp.
References mim::Lit::as(), mim::ll::BB::assign(), mim::Annex::Base, mim::bitcast(), mim::ll::BB::body(), mim::App::callee(), declare(), mim::Emitter< std::string, std::string, BB, Emitter >::emit(), mim::Emitter< std::string, std::string, BB, Emitter >::emit_unsafe(), mim::Emitter< std::string, std::string, BB, Emitter >::entry_, mim::error(), mim::force(), mim::Emitter< std::string, std::string, BB, Emitter >::globals_, mim::Lit::isa(), mim::plug::math::isa_f(), mim::Emitter< std::string, std::string, BB, Emitter >::lam2bb_, mim::match(), mim::Phase::name(), mim::print(), mim::Def::proj(), mim::Def::projs(), mim::Idx::size(), mim::Idx::size2bitwidth(), mim::ll::BB::tail(), and mim::Def::type().
void mim::ll::Emitter::emit_epilogue | ( | Lam * | lam | ) |
Definition at line 317 of file ll.cpp.
References mim::Lam::body(), declare(), mim::Emitter< std::string, std::string, BB, Emitter >::emit(), mim::Emitter< std::string, std::string, BB, Emitter >::emit_unsafe(), mim::Emitter< std::string, std::string, BB, Emitter >::entry_, mim::Pi::isa_basicblock(), mim::Lam::isa_mut_basicblock(), mim::Pi::isa_returning(), mim::Emitter< std::string, std::string, BB, Emitter >::lam2bb_, mim::Emitter< std::string, std::string, BB, Emitter >::locals_, mim::match(), mim::Phase::name(), mim::Def::num_vars(), mim::print(), mim::Lam::ret_var(), and mim::Phase::world().
void mim::ll::Emitter::emit_imported | ( | Lam * | lam | ) |
Definition at line 256 of file ll.cpp.
References mim::match(), mim::print(), mim::Pi::ret_pi(), and mim::Lam::type().
void mim::ll::Emitter::finalize | ( | const Scope & | scope | ) |
Definition at line 288 of file ll.cpp.
References mim::Scope::exit(), mim::Emitter< std::string, std::string, BB, Emitter >::lam2bb_, mim::print(), mim::Tab::print(), mim::Scheduler::schedule(), mim::ScopePhase::scope(), and mim::Emitter< std::string, std::string, BB, Emitter >::tab.
std::string mim::ll::Emitter::prepare | ( | const Scope & | scope | ) |
Definition at line 270 of file ll.cpp.
References mim::Def::as_mut(), mim::Scope::entry(), mim::Emitter< std::string, std::string, BB, Emitter >::locals_, mim::match(), mim::Phase::name(), mim::print(), and mim::ScopePhase::scope().
void mim::ll::Emitter::prepare | ( | Lam * | , |
std::string_view | ) |
|
overridevirtual |
Actual entry.
Implements mim::Phase.
Definition at line 246 of file ll.cpp.
References mim::Emitter< std::string, std::string, BB, Emitter >::ostream(), and mim::Phase::start().