6#include <absl/container/node_hash_map.h>
51 if (fs::exists(path) && fs::is_directory(path)) search_paths_.insert(insert_, std::move(path));
73 const auto&
entries()
const {
return entries_; }
78 auto begin()
const {
return entries_.cbegin(); }
79 auto end()
const {
return entries_.cend(); }
87 std::deque<Entry> entries_;
88 std::deque<fs::path> parsed_paths_;
102 void load(
const std::string& name) {
return load(sym(name)); }
108 return reinterpret_cast<F*
>(
get_fun_ptr(plugin, name));
121 const auto&
stages()
const {
return stages_; }
128 absl::node_hash_map<Sym, Plugin::Handle> plugins_;
133 std::list<fs::path> search_paths_;
134 std::list<fs::path>::iterator insert_ = search_paths_.end();
140#define GET_FUN_PTR(plugin, f) get_fun_ptr<decltype(f)>(plugin, #f)
const auto & entries() const
std::pair< const fs::path *, bool > add(fs::path, Sym, ast::Tok::Tag)
Remembers an import or plugin directive and reports whether the resolved file is new.
const auto & stages() const
const Imports & imports() const
void add_search_path(fs::path path)
const Version & version() const
MimIR Version.
auto normalizer(plugin_t d, tag_t t, sub_t s) const
const Flags & flags() const
bool is_loaded(Sym sym) const
Driver & operator=(Driver)=delete
void * get_fun_ptr(Sym plugin, const char *name)
auto normalizer(flags_t flags) const
Driver(const Driver &)=delete
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)
auto stage(flags_t flags)
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< std::unique_ptr< Stage >(World &)> > Flags2Stages
Maps an an axiom of a Stage to a function that creates one.
absl::flat_hash_map< flags_t, NormalizeFn > Normalizers
Compiler switches that must be saved and looked up in later phases of compilation.
static constexpr flags_t flags(plugin_t p, tag_t t, sub_t s=0)
Assembles the full flags from its plugin, tag, and sub fields.