6#include <absl/container/node_hash_map.h>
54 if (fs::exists(path) && fs::is_directory(path)) search_paths_.insert(insert_, std::move(path));
76 const auto&
entries()
const {
return entries_; }
81 auto begin()
const {
return entries_.cbegin(); }
82 auto end()
const {
return entries_.cend(); }
90 std::deque<Entry> entries_;
91 std::deque<fs::path> parsed_paths_;
105 void load(
const std::string& name) {
return load(sym(name)); }
111 return reinterpret_cast<F*
>(
get_fun_ptr(plugin, name));
124 const auto&
phases()
const {
return phases_; }
133 void add_arg(Sym plugin, std::string arg) { plugin_args_[plugin].emplace_back(std::move(arg)); }
139 absl::node_hash_map<Sym, Plugin::Handle> plugins_;
145 std::list<fs::path> search_paths_;
146 std::list<fs::path>::iterator insert_ = search_paths_.end();
149 fe::SymMap<Vector<std::string>> plugin_args_;
153#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 Imports & imports() const
void add_search_path(fs::path path)
const Vector< std::string > & args(Sym plugin) const
Yields an empty Vector if plugin has none.
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
const Profiler & profiler() 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)
const auto & phases() const
void add_arg(Sym plugin, std::string arg)
auto phase(flags_t flags)
const auto & search_paths() const
Facility to log what you are doing.
Records wall-clock timings for (possibly nested) Phase runs and reports them in various formats.
This is a thin wrapper for absl::InlinedVector<T, N, A> which is a drop-in replacement for std::vecto...
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< Phase >(World &)> > Flags2Phases
Maps an axiom of a Phase to a function that creates one.
absl::flat_hash_map< flags_t, NormalizeFn > Normalizers
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.
Compiler switches that must be saved and looked up in later phases of compilation.