Some "global" variables needed all over the place. More...
#include <mim/driver.h>
Classes | |
| struct | Names |
| class | Paths |
| An ordered list of directories. More... | |
| class | Imports |
Public Member Functions | |
Construction | |
| Driver (std::string name={}) | |
| Driver (const Driver &)=delete | |
| Driver (Driver &&)=delete | |
| Driver & | operator= (Driver)=delete |
Getters | |
| Flags & | flags () |
| const Flags & | flags () const |
| fe::Log & | log () |
| const fe::Log & | log () const |
| fe::Profiler & | profiler () |
| const fe::Profiler & | profiler () const |
| World & | world () |
| const Version & | version () const |
| MimIR Version. | |
| const Keys & | keys () const |
| Interned once here: every ast::Lexer borrows them. | |
Diagnostic Naming | |
Scratch state for PlainNames: which plain Def::sym each gid claimed while one message is formatted. It lives here - not in a global - so that concurrent Drivers never share it. | |
| Names & | names () const |
Manage Search Paths | |
A plain directory is probed as-is; a prefix root stands for an install tree and derives <root>/<libdir>/mim (plugins), <root>/<datadir>/mim (imports), and <root>/<libdir>/mim/rt (runtimes). Each lookup starts with the empty path, which probes the current working directory without an absolute path. Within a list, paths added first are searched first; CLI paths precede the environment and derived ones. | |
| void | add_plugin_path (fs::path path) |
| void | add_import_path (fs::path path) |
| void | add_prefix_path (fs::path path) |
| fe::Vector< fs::path > | plugin_paths () const |
| Where Driver::load looks for libmim_<name>. | |
| fe::Vector< fs::path > | import_paths () const |
| Where ast::Parser looks for <name>.mim; plugin directories are included, as a plugin ships both halves. | |
| fe::Vector< fs::path > | rt_paths () const |
| Where a backend looks for its runtime modules. | |
Manage Imports | |
Tracks the distinct import or plugin directives that World::dump should emit again later. | |
| const Imports & | imports () const |
| Imports & | imports () |
Load Plugin | |
Finds and loads a shared object file that implements the MimIR Plugin If name is an absolute path to a .so/.dll file, this is used. Otherwise, "name", "libmim_name.so" (Linux, Mac), "mim_name.dll" (Win) are searched for in Driver::search_paths(). | |
| void | load (std::string_view name) |
| bool | is_loaded (std::string_view name) const |
| const fs::path * | plugin_dir (std::string_view name) const |
| Directory libmim_<name> was loaded from, so that its <name>.mim half cannot come from elsewhere. | |
| void * | get_fun_ptr (std::string_view plugin, const char *name) |
| template<class F> | |
| auto | get_fun_ptr (std::string_view plugin, const char *name) |
Manage Plugins | |
All these lookups yield nullptr if the key has not been found. | |
| auto | phase (flags_t flags) |
| const auto & | phases () const |
| auto | normalizer (flags_t flags) const |
| auto | normalizer (plugin_t d, tag_t t, sub_t s) const |
Plugin/Phase Arguments | |
Freeform command-line arguments addressed to a plugin/phase (-X <plugin>:<arg>). A Phase reads its own arguments via Phase::args(). | |
| void | add_arg (std::string_view plugin, std::string arg) |
| const fe::Vector< std::string > & | args (std::string_view plugin) const |
Yields an empty fe::Vector if plugin has none. | |
| const auto & | known_args () const |
| The PluginArgs each loaded Plugin declares, in load order; only for listing them, see PluginArg. | |
| const auto & | known_envs () const |
| The PluginEnvs each loaded Plugin declares, in load order; only for listing them, see PluginEnv. | |
Some "global" variables needed all over the place.
Well, there are not really global - that's the point of this class.
| struct mim::Driver::Names |
| mim::Driver::Driver | ( | std::string | name = {} | ) |
Definition at line 52 of file driver.cpp.
References add_import_path(), add_plugin_path(), add_prefix_path(), CODE, Driver(), MIM_INSTALL_PREFIX, MIM_KEY, MIM_SUBST, and MIM_VERSION.
Referenced by Driver(), Driver(), Driver(), and operator=().
|
delete |
References Driver().
|
delete |
References Driver().
|
inline |
|
inline |
|
inline |
|
inline |
| const fe::Vector< std::string > & mim::Driver::args | ( | std::string_view | plugin | ) | const |
Yields an empty fe::Vector if plugin has none.
Definition at line 185 of file driver.cpp.
Referenced by mim::Phase::args().
|
inline |
Definition at line 76 of file driver.h.
Referenced by mim::World::flags(), load(), mim::ast::load_plugins(), main(), normalizer(), phase(), mim::Phase::run(), mim::PhaseMan::start(), and mim::RWBase::start().
|
inline |
Definition at line 183 of file driver.h.
References get_fun_ptr().
| void * mim::Driver::get_fun_ptr | ( | std::string_view | plugin, |
| const char * | name ) |
Definition at line 180 of file driver.cpp.
Referenced by get_fun_ptr().
| fe::Vector< fs::path > mim::Driver::import_paths | ( | ) | const |
Where ast::Parser looks for <name>.mim; plugin directories are included, as a plugin ships both halves.
Definition at line 102 of file driver.cpp.
References MIM_DATADIR, and MIM_LIBDIR.
Referenced by main().
|
inline |
Definition at line 166 of file driver.h.
Referenced by mim::ast::Parser::import().
|
inline |
Definition at line 177 of file driver.h.
Referenced by mim::plug::ll::Emitter::Emitter(), and load().
|
inline |
Interned once here: every ast::Lexer borrows them.
|
inline |
|
inline |
| void mim::Driver::load | ( | std::string_view | name | ) |
Definition at line 126 of file driver.cpp.
References flags(), is_loaded(), log(), mim::mim_get_plugin(), plugin_paths(), and version().
Referenced by mim::plug::ll::Emitter::Emitter(), and mim::ast::Parser::import().
|
inline |
Definition at line 78 of file driver.h.
Referenced by mim::World::Annexes::attach(), mim::ast::Parser::import(), mim::ast::Parser::import(), load(), mim::World::log(), and main().
|
inline |
Definition at line 97 of file driver.h.
Referenced by mim::PlainNames::claim().
|
inline |
Definition at line 194 of file driver.h.
References mim::Annex::flags(), and normalizer().
Referenced by normalizer().
|
inline |
Definition at line 191 of file driver.h.
References flags().
Referenced by mim::optimize(), mim::Phase::recreate(), and mim::plug::gpu::phase::run_stage().
|
inline |
| fe::Vector< fs::path > mim::Driver::plugin_paths | ( | ) | const |
Where Driver::load looks for libmim_<name>.
Definition at line 92 of file driver.cpp.
References MIM_LIBDIR.
|
inline |
Definition at line 80 of file driver.h.
Referenced by mim::Phase::profile_count(), and mim::Phase::run().
| fe::Vector< fs::path > mim::Driver::rt_paths | ( | ) | const |
Where a backend looks for its runtime modules.
Definition at line 116 of file driver.cpp.
References MIM_LIBDIR.
Referenced by main().
|
inline |