5#include <absl/container/node_hash_map.h>
38 if (fs::exists(path) && fs::is_directory(path)) search_paths_.insert(insert_, std::move(path));
47 const auto&
imports() {
return imports_; }
59 void load(
const std::string& name) {
return load(sym(name)); }
62 template<
class F>
auto get_fun_ptr(Sym plugin,
const char* name) {
63 return reinterpret_cast<F*
>(
get_fun_ptr(plugin, name));
65 template<
class F>
auto get_fun_ptr(
const char* plugin,
const char* name) {
81 absl::node_hash_map<Sym, Plugin::Handle> plugins_;
85 std::list<fs::path> search_paths_;
86 std::list<fs::path>::iterator insert_ = search_paths_.end();
90 std::deque<std::pair<fs::path, Sym>> imports_;
93#define GET_FUN_PTR(plugin, f) get_fun_ptr<decltype(f)>(plugin, #f)
Some "global" variables needed all over the place.
void add_search_path(fs::path path)
auto backend(std::string_view name)
auto normalizer(plugin_t d, tag_t t, sub_t s) const
bool is_loaded(Sym sym) const
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.
void * get_fun_ptr(Sym plugin, const char *name)
auto normalizer(flags_t flags) const
void load(const std::string &name)
auto get_fun_ptr(Sym plugin, const char *name)
auto get_fun_ptr(const char *plugin, const char *name)
const auto & search_paths() const
Facility to log what you are doing.
The World represents the whole program and manages creation of MimIR nodes (Defs).
auto lookup(const C &container, const K &key)
Yields pointer to element (or the element itself if it is already a pointer), if found and nullptr ot...
absl::flat_hash_map< flags_t, std::function< void(World &, PipelineBuilder &, const Def *)> > Passes
axiom ↦ (pipeline part) × (axiom application) → () The function should inspect Application to const...
absl::btree_map< std::string, void(*)(World &, std::ostream &)> Backends
absl::flat_hash_map< flags_t, NormalizeFn > Normalizers
Compiler switches that must be saved and looked up in later phases of compilation.