MimIR
MimIR is my Intermediate Representation
Loading...
Searching...
No Matches
mim::Driver Class Reference

Some "global" variables needed all over the place. More...

#include <mim/driver.h>

Inheritance diagram for mim::Driver:
[legend]

Classes

class  Imports

Public Member Functions

Construction
 Driver (std::string name)
 Driver ()
 Driver (const Driver &)=delete
 Driver (Driver &&)=delete
Driveroperator= (Driver)=delete
Getters
Flagsflags ()
const Flagsflags () const
Loglog () const
Profilerprofiler ()
const Profilerprofiler () const
Worldworld ()
const Versionversion () const
 MimIR Version.
Manage Search Paths

Search paths for plugins are in the following order:

  1. The empty path. Used as prefix to look into current working directory without resorting to an absolute path.
  2. All further user-specified paths via Driver::add_search_path; paths added first will also be searched first.
  3. All paths specified in the environment variable MIM_PLUGIN_PATH.
  4. The path derived from the location of libmim (<libmim>/mim)
  5. CMAKE_INSTALL_PREFIX/lib/mim
const auto & search_paths () const
void add_search_path (fs::path path)
Manage Imports

This tracks:

  1. The distinct files that have already been parsed to avoid reparsing them,
  2. The distinct import or plugin directives that should be emitted again later.
const Importsimports () const
Importsimports ()
Load Plugin

Finds and loads a shared object file that implements the MimIR Plugin name.

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 (Sym name)
void load (const std::string &name)
bool is_loaded (Sym sym) const
void * get_fun_ptr (Sym plugin, const char *name)
template<class F>
auto get_fun_ptr (Sym plugin, const char *name)
template<class F>
auto get_fun_ptr (const char *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 (Sym plugin, std::string arg)
const Vector< std::string > & args (Sym plugin) const
 Yields an empty Vector if plugin has none.

Detailed Description

Some "global" variables needed all over the place.

Well, there are not really global - that's the point of this class.

Definition at line 20 of file driver.h.

Constructor & Destructor Documentation

◆ Driver() [1/4]

mim::Driver::Driver ( std::string name)

◆ Driver() [2/4]

mim::Driver::Driver ( )
inline

Definition at line 25 of file driver.h.

References Driver().

◆ Driver() [3/4]

mim::Driver::Driver ( const Driver & )
delete

References Driver().

◆ Driver() [4/4]

mim::Driver::Driver ( Driver && )
delete

References Driver().

Member Function Documentation

◆ add_arg()

void mim::Driver::add_arg ( Sym plugin,
std::string arg )
inline

Definition at line 133 of file driver.h.

Referenced by main().

◆ add_search_path()

void mim::Driver::add_search_path ( fs::path path)
inline

Definition at line 53 of file driver.h.

Referenced by Driver(), and main().

◆ args()

const Vector< std::string > & mim::Driver::args ( Sym plugin) const

Yields an empty Vector if plugin has none.

Definition at line 127 of file driver.cpp.

Referenced by mim::Phase::args().

◆ flags() [1/2]

Flags & mim::Driver::flags ( )
inline

◆ flags() [2/2]

const Flags & mim::Driver::flags ( ) const
inline

Definition at line 36 of file driver.h.

◆ get_fun_ptr() [1/3]

template<class F>
auto mim::Driver::get_fun_ptr ( const char * plugin,
const char * name )
inline

Definition at line 115 of file driver.h.

References get_fun_ptr().

◆ get_fun_ptr() [2/3]

template<class F>
auto mim::Driver::get_fun_ptr ( Sym plugin,
const char * name )
inline

Definition at line 110 of file driver.h.

References get_fun_ptr().

◆ get_fun_ptr() [3/3]

void * mim::Driver::get_fun_ptr ( Sym plugin,
const char * name )

Definition at line 122 of file driver.cpp.

References mim::dl::get(), and mim::lookup().

Referenced by get_fun_ptr(), and get_fun_ptr().

◆ imports() [1/2]

Imports & mim::Driver::imports ( )
inline

Definition at line 95 of file driver.h.

◆ imports() [2/2]

const Imports & mim::Driver::imports ( ) const
inline

Definition at line 94 of file driver.h.

◆ is_loaded()

bool mim::Driver::is_loaded ( Sym sym) const
inline

Definition at line 106 of file driver.h.

References mim::lookup().

Referenced by load().

◆ load() [1/2]

void mim::Driver::load ( const std::string & name)
inline

Definition at line 105 of file driver.h.

References load().

Referenced by load().

◆ load() [2/2]

◆ log()

Log & mim::Driver::log ( ) const
inline

Definition at line 37 of file driver.h.

Referenced by mim::World::log(), and main().

◆ normalizer() [1/2]

auto mim::Driver::normalizer ( flags_t flags) const
inline

Definition at line 125 of file driver.h.

References flags(), and mim::lookup().

◆ normalizer() [2/2]

auto mim::Driver::normalizer ( plugin_t d,
tag_t t,
sub_t s ) const
inline

Definition at line 126 of file driver.h.

References mim::Annex::flags(), and normalizer().

Referenced by normalizer().

◆ operator=()

Driver & mim::Driver::operator= ( Driver )
delete

References Driver().

◆ phase()

auto mim::Driver::phase ( flags_t flags)
inline

Definition at line 123 of file driver.h.

References flags(), and mim::lookup().

Referenced by mim::optimize(), mim::Phase::recreate(), and mim::plug::gpu::phase::run_stage().

◆ phases()

const auto & mim::Driver::phases ( ) const
inline

Definition at line 124 of file driver.h.

◆ profiler() [1/2]

Profiler & mim::Driver::profiler ( )
inline

Definition at line 38 of file driver.h.

Referenced by main(), mim::Phase::profile_count(), and mim::Phase::run().

◆ profiler() [2/2]

const Profiler & mim::Driver::profiler ( ) const
inline

Definition at line 39 of file driver.h.

◆ search_paths()

const auto & mim::Driver::search_paths ( ) const
inline

Definition at line 52 of file driver.h.

Referenced by Driver(), load(), and main().

◆ version()

const Version & mim::Driver::version ( ) const
inline

MimIR Version.

Definition at line 41 of file driver.h.

Referenced by load(), and main().

◆ world()

World & mim::Driver::world ( )
inline

Definition at line 40 of file driver.h.

Referenced by main().


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