MimIR 0.1
MimIR is my Intermediate Representation
Loading...
Searching...
No Matches
prefix_cleanup.cpp
Go to the documentation of this file.
2
3#include <mim/lam.h>
4
5namespace mim {
6
8 : RWPhase(world, std::format("prefix_cleanup `{}`", prefix))
9 , prefix_(std::move(prefix)) {}
10
12 if (mut->sym().view().starts_with(prefix_)) {
13 mut->make_internal();
14 new_world().DLOG("internalized {}", mut);
15 } else {
16 mut->transfer_external(rewrite(mut)->as_mut());
17 }
18}
19
20} // namespace mim
Base class for all Defs.
Definition def.h:251
void make_internal()
Definition def.cpp:564
void transfer_external(Def *to)
Definition def.cpp:566
Sym sym() const
Definition def.h:504
void rewrite_external(Def *) final
PrefixCleanup(World &, std::string prefix="internal_")
World & new_world()
Create new Defs into this.
Definition phase.h:99
RWPhase(World &world, std::string name)
Definition phase.h:73
World & world()=delete
Hides both and forbids direct access.
virtual const Def * rewrite(const Def *)
Definition rewrite.cpp:14
The World represents the whole program and manages creation of MimIR nodes (Defs).
Definition world.h:36
Definition ast.h:14
Definition span.h:122