MimIR
0.4-dev
MimIR is my Intermediate Representation
Toggle main menu visibility
Loading...
Searching...
No Matches
unload.cpp
Go to the documentation of this file.
1
#include "
mim/phase/unload.h
"
2
3
#include "
mim/driver.h
"
4
5
namespace
mim
{
6
7
void
Unload::apply
(std::string plugin) {
8
plugin_str_ = std::move(plugin);
9
name_
+=
" \""
+ plugin_str_ +
"\""
;
10
if
(
auto
mangled =
Annex::mangle
(plugin_str_))
11
plugin_ = *mangled;
12
else
13
fe::throwf(
"invalid plugin name `{}`"
, plugin_str_);
14
}
15
16
void
Unload::start
() {
17
auto
& flags2entry =
world
().
annexes
().
flags2entry
();
18
auto
& sym2flags =
world
().
annexes
().
sym2flags
();
19
for
(
auto
i = flags2entry.begin(); i != flags2entry.end();) {
20
auto
[flags, entry] = *i;
21
22
if
(
Annex::flags2plugin
(flags) == plugin_) {
23
i = flags2entry.erase(i);
24
sym2flags.erase(entry.sym);
25
}
else
26
++i;
27
}
28
29
// we could also literally unload the shared object now, but it's probably not worth the trouble
30
}
31
32
}
// namespace mim
mim::Phase::name_
std::string name_
Definition
phase.h:123
mim::Phase::world
World & world()
Definition
phase.h:77
mim::Unload::apply
void apply(std::string)
Definition
unload.cpp:7
mim::Unload::start
void start() final
Actual entry.
Definition
unload.cpp:16
mim::World::Annexes::flags2entry
auto & flags2entry()
An annex's flags map to its full name and its Def.
Definition
world.h:222
mim::World::Annexes::sym2flags
auto & sym2flags()
Definition
world.h:228
mim::World::annexes
Annexes & annexes()
Definition
world.h:281
driver.h
mim
Definition
ast.h:16
mim::Annex::mangle
static std::optional< plugin_t > mangle(std::string_view plugin)
Mangles s into a dense 48-bit representation.
Definition
plugin.cpp:5
mim::Annex::flags2plugin
static constexpr plugin_t flags2plugin(flags_t f)
Definition
plugin.h:228
unload.h
src
mim
phase
unload.cpp
Generated by
1.18.0