Thorin 1.9.0
The Higher ORder INtermediate representation
Loading...
Searching...
No Matches
thorin::Driver Class Reference

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

#include <thorin/driver.h>

Inheritance diagram for thorin::Driver:
[legend]

Public Member Functions

 Driver ()
 
Getters
Flagsflags ()
 
Loglog ()
 
Worldworld ()
 
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 THORIN_PLUGIN_PATH.
  4. path/to/thorin.exe/../../lib/thorin
  5. CMAKE_INSTALL_PREFIX/lib/thorin
const auto & search_paths () const
 
void add_search_path (fs::path path)
 
Manage Imports

This is a list of pairs where each pair contains:

  1. The fs::path used during import,
  2. The name as Symbol used in the .import directive or in Parser::import.
const auto & imports ()
 
const fs::path * add_import (fs::path, Sym)
 Yields a fs::path* if not already added that you can use in Location; returns nullptr otherwise.
 
Load Plugin

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

If name is an absolute path to a .so/.dll file, this is used. Otherwise, "name", "libthorin_name.so" (Linux, Mac), "thorin_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 pass (flags_t flags)
 
auto normalizer (flags_t flags) const
 
auto normalizer (plugin_t d, tag_t t, sub_t s) const
 
auto backend (std::string_view name)
 
Manage Annex
const auto & plugin2annxes (Sym plugin)
 
std::pair< Annex &, bool > name2annex (Sym sym, Sym plugin, Sym tag, Loc loc)
 

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 17 of file driver.h.

Constructor & Destructor Documentation

◆ Driver()

thorin::Driver::Driver ( )

Member Function Documentation

◆ add_import()

const fs::path * thorin::Driver::add_import ( fs::path  path,
Sym  sym 
)

Yields a fs::path* if not already added that you can use in Location; returns nullptr otherwise.

Definition at line 45 of file driver.cpp.

Referenced by thorin::Parser::import().

◆ add_search_path()

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

Definition at line 37 of file driver.h.

Referenced by Driver().

◆ backend()

auto thorin::Driver::backend ( std::string_view  name)
inline

Definition at line 76 of file driver.h.

References thorin::lookup().

◆ flags()

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

Definition at line 23 of file driver.h.

Referenced by thorin::World::flags(), main(), normalizer(), and pass().

◆ get_fun_ptr() [1/3]

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

Definition at line 65 of file driver.h.

◆ get_fun_ptr() [2/3]

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

Definition at line 91 of file driver.cpp.

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

Referenced by get_fun_ptr().

◆ get_fun_ptr() [3/3]

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

Definition at line 62 of file driver.h.

References get_fun_ptr().

◆ imports()

const auto & thorin::Driver::imports ( )
inline

Definition at line 47 of file driver.h.

Referenced by thorin::World::dump().

◆ is_loaded()

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

Definition at line 60 of file driver.h.

References thorin::lookup().

Referenced by thorin::World::dump(), and load().

◆ load() [1/2]

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

Definition at line 59 of file driver.h.

References load().

Referenced by load().

◆ load() [2/2]

◆ log()

Log & thorin::Driver::log ( )
inline

Definition at line 24 of file driver.h.

Referenced by thorin::World::log().

◆ name2annex()

std::pair< Annex &, bool > thorin::Driver::name2annex ( Sym  sym,
Sym  plugin,
Sym  tag,
Loc  loc 
)

Definition at line 96 of file driver.cpp.

References thorin::error().

◆ normalizer() [1/2]

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

Definition at line 74 of file driver.h.

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

◆ normalizer() [2/2]

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

Definition at line 75 of file driver.h.

References normalizer().

Referenced by normalizer().

◆ pass()

auto thorin::Driver::pass ( flags_t  flags)
inline

Definition at line 73 of file driver.h.

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

Referenced by thorin::optimize().

◆ plugin2annxes()

const auto & thorin::Driver::plugin2annxes ( Sym  plugin)
inline

Definition at line 81 of file driver.h.

Referenced by thorin::bootstrap().

◆ search_paths()

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

Definition at line 36 of file driver.h.

Referenced by Driver(), thorin::Parser::import(), and load().

◆ world()

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

Definition at line 25 of file driver.h.


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