6#include <absl/container/btree_map.h>
7#include <absl/container/flat_hash_map.h>
22using Flags2Stages = absl::flat_hash_map<flags_t, std::function<std::unique_ptr<Stage>(
World&)>>;
24using Backends = absl::btree_map<std::string, void (*)(
World&, std::ostream&)>;
31 using Handle = std::unique_ptr<void, void (*)(
void*)>;
79 static std::optional<plugin_t>
mangle(Sym plugin);
85 static std::tuple<Sym, Sym, Sym>
split(
Driver&, Sym);
116 template<
class Id>
static constexpr size_t Num = size_t(-1);
118 template<
class Id>
static consteval size_t num () {
return Num <Id>; }
Some "global" variables needed all over the place.
Common base for Phase and Pass.
The World represents the whole program and manages creation of MimIR nodes (Defs).
absl::btree_map< std::string, void(*)(World &, std::ostream &)> Backends
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.
mim::Plugin mim_get_plugin()
absl::flat_hash_map< flags_t, NormalizeFn > Normalizers
static sub_t flags2sub(flags_t f)
Yields the sub part of the name as integer.
static std::tuple< Sym, Sym, Sym > split(Driver &, Sym)
static constexpr plugin_t Global_Plugin
static plugin_t flags2plugin(flags_t f)
static constexpr size_t Max_Plugin_Size
static flags_t flags2base(flags_t f)
Includes Axm::plugin() and Axm::tag() but not Axm::sub.
static Sym demangle(Driver &, plugin_t plugin)
Reverts an Axm::mangled string to a Sym.
static std::optional< plugin_t > mangle(Sym plugin)
Mangles s into a dense 48-bit representation.
static consteval size_t num()
static constexpr size_t Num
Number of Axm::subtags.
static consteval flags_t base()
static constexpr flags_t Base
static tag_t flags2tag(flags_t f)
Yields the tag part of the name as integer.
Basic info and registration function pointer to be returned from a specific plugin.
const char * plugin_name
Name of the Plugin.
void(* register_backends)(Backends &)
Callback for registering the mapping from backend names to emission functions in the given backends m...
void(* register_stages)(Flags2Stages &)
Callback for registering the Plugin's callbacks for Passes and Phases.
std::unique_ptr< void, void(*)(void *)> Handle
void(* register_normalizers)(Normalizers &)
Callback for registering the mapping from axm ids to normalizer functions in the given normalizers ma...